Absolute minimal way of implementing a "run only on initial scene load"?
Backtothis
Member, PRO Posts: 75
So basically let's say there's a little bit of initialization I want to run at the start of each scene, maybe a camera thing or position offsets or something. The way I've thought about doing it now is to have a variable, call it "initialLoad", which is set to true to begin with.
We also have an actor, call it "initialize", which does the initialization. At the end of initialize, initialLoad is set to false, and initialize only does its work if initialLoad is true.
Then immediately before any scene transition, we set initialLoad to true (theoretically the scene transition should be the next executed command right? So no race conditions that could cause weird things to happen should ever happen).
Is there any better way of doing it? My main concerns right now is that it just feels unelegant having the implied (rather than explicit) necessity of having a specific change attribute in front of every scene transition. I'm also not quite sure if I'm correct in assuming there is no race condition.
We also have an actor, call it "initialize", which does the initialization. At the end of initialize, initialLoad is set to false, and initialize only does its work if initialLoad is true.
Then immediately before any scene transition, we set initialLoad to true (theoretically the scene transition should be the next executed command right? So no race conditions that could cause weird things to happen should ever happen).
Is there any better way of doing it? My main concerns right now is that it just feels unelegant having the implied (rather than explicit) necessity of having a specific change attribute in front of every scene transition. I'm also not quite sure if I'm correct in assuming there is no race condition.
Comments
So basically inside an actior, its like
Rule 1 {}
Rule 2 {}
Rule N {}
Behavior 1 {}
And behavior 1 only triggers once? I never knew that lol.