I’m trying to set a Player gameobject variable on my global blackboard at the start of the scene so I can easily refer to the player from any asset script, but sometimes the other gameobjects check the global Player variable before it has been set On Awake. My workaround is to use WaitUntilEndOfFrame on the gameobject that’s checking the Player variable, but this is a workaround and won’t be very useful on scene changes when I need to set the DoNotDestroyOnLoad global blackboard at the very start of each scene to the player reference. Is there a way of forcing a particular flow to run before any other gameobject? For reference, the flow that’s checking the Player variable is inside Update and I tried setting the Player variable reference on both Awake, Enable and Start, and none of them happen before this particular Update, so I can only assume that gameobject’s flow will always happen first before the variable is set.
I’m trying to actually get my project to break again to test, but I can’t, haha! I think that’s the issue with setting variables on a single place like a global blackboard and using that for every graph’s reference, it can go along for ages working and then Unity might just decide to check the gameobjects before the global blackboard has set it’s scene references, and it breaks. The fix definitely worked for setting the variable before the CharacterControllerOnHit event, I just wish I could cause the problem I was having before! I might try a full fresh test and see if it works.
Author
Posts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.