- Home /
Question by
tung · Jul 14, 2012 at 02:14 PM ·
synchronizationsync
How to synchronize in Unity?
Hi, I have two monobehavior which modifies the value of 1 parameter.
1) How do I know which monobehavior is called first?
2) Also is there away to prioritize a monobehavior over the other (let behavior 1 do something before the other)?
3) Is there away to explicitly block access to the parameter until I explicitly release the lock (the normal way to sync)?
Thanks.
Comment
Answer by whydoidoit · Jul 14, 2012 at 02:26 PM
- Order of equivalent priority scripts is not guaranteed.
You can set the priority of scripts using Edit>Project Settings>Script Execution Order
You could use your own boolean - these things are not threads so you can't use synchronisation locks
Sometimes its worth having one item do something in Awake and the other in Start.
Your answer