Reputation: 4312
I have the same scrolling script attached to multiple game objects. But I want them executed in sequence. At present they were executing, I can say randomly so they aren't able to achieve synchronisation with each other in order.
So I want them executed based on each gameobject's order rather then each one randomly selected.
Upvotes: 1
Views: 305
Reputation: 3514
You can define your own UpdateManually
method and call it in the appropriate order yourself. For example:
public class ScrollScriptUpdater : MonoBehaviour
{
// set references according to desired update order
// this can be done in the editor or via script if appropriate
public List<ScrollScript> ScrollScripts;
void Update ()
{
// this updates in the natural order of the list,
// list item 0, 1, 2, ...
foreach (var script in ScrollScripts)
{
script.UpdateManually();
}
}
}
public class ScrollScript : MonoBehaviour
{
public void UpdateManually()
{
// do stuff
}
}
Upvotes: 1