ReferenceScene Graph

Scene Graph Get Component

Fetch a component off an entity with a failable get: `if (Mesh := Entity.GetComponent[mesh_component]):` binds it only when present, so you can drive it from Verse.

Updated
The code on this reference page did not pass the latest compile check — verify it in your project.

Your entity is like a chest that might be carrying a mesh component — the thing that actually draws the platform in the world. But you can't assume it's in there.

Picture opening the chest: if it's full, you get the mesh handle; if it's empty, the grab just fails and you skip ahead. No crash, no guessing.

We write if Mesh comes from Entity dot GetComponent of mesh_component — the square brackets mean it can fail. When it succeeds, Mesh is bound inside the block, so we Disable it, Sleep two seconds, then Enable it to make the platform blink.

GetComponent[] only hands you the part when it's really there.

if (Mesh := Entity.GetComponent[mesh_component]):
    Mesh.Disable()
    Sleep(2.0)
    Mesh.Enable()

Build your own lesson with scene_graph_get_component

Generate a personalized, compile-checked lesson grounded in this exact reference.

Build a lesson →