SCRIPTING API / Scripts and entities / WaitForLateUpdate
WaitForLateUpdate
Continues the coroutine this frame, after every script's OnLateUpdate (where cameras follow their targets).
Kindclass
NamespaceKroys.EngineScripting
Members0
Source
Coroutine.csEXAMPLE
In a script
A complete script that uses WaitForLateUpdate; copy it into your scripts project.
Coroutines.cs
public sealed class SnapCameraOnTeleport : EntityScript { // Called by a portal script that knows the camera entity. public void Teleport(Vector3 destination, Entity camera) => StartCoroutine(TeleportAndSnap(destination, camera)); private IEnumerator TeleportAndSnap(Vector3 destination, Entity camera) { Transform transform = Transform; transform.Position = destination; // Wait until every script has run OnLateUpdate this frame (the camera follower too), // then place the camera so it does not glide across the map. yield return new WaitForLateUpdate(); if (camera.IsValid) { Transform cameraTransform = camera.Transform; cameraTransform.Position = destination + new Vector3(0.0f, 2.0f, -5.0f); } } }
KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.