Verse Library verse

02 Fragment

Extension methods to toggle an entity mesh visibility on and off.

verse-library/verse-scene-graph-entities-components/02-fragment.verse

# Hide the entity by turning off its mesh.
(Entity:entity).Hide():void =
    if:
        Mesh := Entity.GetComponent[mesh_component]
    then:
        Mesh.Disable()

# Show the entity by turning its mesh back on.
(Entity:entity).Show():void =
    if:
        Mesh := Entity.GetComponent[mesh_component]
    then:
        Mesh.Enable()

Comments

    Sign in to vote, comment, or suggest an edit. Sign in