I'm trying to find the appropriate words to use to describe the issue that I am having, hopefully this will explain the problem.
I have two Update() methods in two different classes, and some of the functionality in one is reliant on data from another. Code A is reliant on Code B's data, using Debug.Log() I found that Code B's Update() is being executed after Code A's Update().
My question is, Is there a out of box method to controller the Call stack of the Update method? If there is how is it done? If there isn't, does anyone have any technique that I could employ to resolve the problem. I realize I could just create methods in Code B that could be called from Code A in update to resolve the problem, but I'm curious to see if there is another way to resolve the problem.
A basic mechanism could be represented by locks.
As an example, let's suppose that A's block depends on B's one. You can control the "dependency" this way:
(ugly comparisons with boolean values where just made to keep the code as much clear as I could :-))
I program in Unityscript and, since your question is tagged with both unityscript and c#, I hope that's sufficient for you.
if its only oneway you could use LateUpdate() instead of Update() in one of the scripts
From Unity's reference manual:
That should solve your problem.