Recently updated to 2.9.7f and ran into a SetParent issue at runtime where my old asset behaviours that reparent certain game objects in the world at runtime no longer keep global orientation.
It seems “world position stays” bool is permanently set to false regardless of which method (SetParent/SetParent, bool) is chosen and checked?
Hmm. I just rechecked the Execute Function and works correctly. If you use the SetParent overload with the “WorldPositionStays” parameter, then it will use that. You will of course need to set the “WorldPositionStays” to true 🙂
What version of the Execute Function are you using? (“Multiplatform” or “Standalone”).
Are you seting the “WorldPositionStays” directly, or is it linked to a Blackboard variable? If linked, are you certain the variable is true at runtime and when the function is called?
I’m currently using the multiplatform function but get the same results from standalone too. Â While checking up on your questions I noticed that the asset uses a global variable game object as a reference that is correctly setup. Â At runtime however the asset behavior loses the reference even though its still showing up in the global blackboard at runtime as being there. Â (See pics). Â After deleting the node and creating it again it seems it now it does not even execute the Setparent function at all (because of the variable being lost somewhere). Â Where as before right after updating it would at least execute the function but not keep world orientation.
Scratching my head at this one although being no expert it could still be entirely my fault somewhere.
As you can see in pics the asset behavior is as simple as you can get just don’t know why now after updating it is breaking the reference to the global variable at runtime even though it’s still showing up.
I believe I finally tracked down what was exactly happening and its not a Setparent issue (thank you for responding) or losing reference to GlobalBlackboard like my above post suggested but turned out to be a very small execution timing change that is effecting my project in this new Node Canvas build.
My scene is procedural so once its generated and then rendered at runtime, the Setparent asset behavior was suppose to come in and reparent certain game objects before other behaviors continue through the rest of the loading process.
Originally the Setparent asset behaviours had a simple condition to only run once it was active and that has served me well as a safeguard for the assets execution order up until now.
It seems somehow with the latest update however the reparent asset behaviours were getting ahead of themselves and reparenting game objects before my procedural generator had a chance to render them and thus every game object would come up with global transform position of 0,0,o regardless as to whether WorldPositionStays was checked or not.
I did a temporary fix by just adding 0.5 sec wait time before the reparenting asset behaviour begins and now generator has time to generate and render scene first and then the reparenting asset begins and grabs the correct global orientation and works correctly.
No idea why the change occurred exactly as the update was the only thing that changed in my project but glad to get back on track. Â Anyways sorry about the two previous shots in the dark as to what was happening and thanks again for checking Setparent execute function.
Thanks a lot for letting me know and for the information. Please note, that there is a setting in the GraphOwner inspector called “First Activation”. The default is “OnEnable”, but you can change this to “OnStart” so that the graph is called after all Awake and OnEnable calls of other scripts. This is something that appeared in recent versions and most probably the reason why you got the issue in the first place.
Thus, changing this to “On Start” will most that certainly solve your problem. Let me know if that indeed works for you.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Author
Posts
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.