Script Extensions
Extension methods for ScriptComponent, in the Stride.CommunityToolkit.Engine namespace. Mostly shortcuts for things a script reaches for on almost every frame.
DeltaTime()- Seconds since the last update, instead of writingGame.UpdateTime.Elapsed.TotalSecondsout in full.GetCamera()- Gets the camera bound to the graphics compositor slot namedMain, or to the slot named bycameraName. Returnsnullwhen no slot matches.GetFirstCamera()- Gets the first camera in the graphics compositor whatever its slot is called, which is usually what you want when there is only one. Returnsnullwhen the compositor has no camera slot.
Note
These look the camera up by its graphics compositor slot rather than by searching the scene, so they
find the camera that is actually being rendered from. A slot is bound a frame or two after the game
starts, so a script's first updates may get null.