- Home /
Event function after Start?
Is there any event function I can subscribe to that happens after canvas performs its layout?
I am using Canvas.ForceUpdateCanvases() https://docs.unity3d.com/ScriptReference/Canvas.ForceUpdateCanvases.html
But this doesn't seem like the best solution to me. I am hoping that there is a function like Start() that runs only once but after all other layout is complete.
Thanks!
Comment
Answer by FlaSh-G · Feb 11 at 06:20 PM
No, there is none: https://docs.unity3d.com/Manual/ExecutionOrder.html
You can, however, trigger a "wait for one frame and then do a thing", for example with a coroutine:
private void Start()
{
StartCoroutine(DoStuffNextFrame());
}
private IEnumerator DoStuffNextFrame()
{
yield return null; // wait one frame
DoStuff();
}