- Home /
Initial script, to run before any others?
Hi! I have been failing at finding any information to do with making a script that is guaranteed to be executed before any others.
I would like to arrange some data into arrays for use in the Start() function of various other scripts. The problem being this, the arrays are not always set-up by the time they are trying to be accessed...
From what I have read the scripts are initially executed in no particular order, making it hard to guarantee which comes first.
Any ideas? Thanks.
Answer by save · May 13, 2012 at 01:24 AM
This is where the Script Execution Order comes to the rescue. You find it at Edit > Project Settings > Script Execution Order. Read up on the predetermined order within a script as well to get a better understanding of the engine.
Fantastic! Exactly what I needed (especially the ordering reference), thank you!
Sorry to poke at such an old quesiton, but the second link for predeter$$anonymous$$ed order seems to be broken.
After changing Color Space, script execution order is broken. This way solved my problem, thanks.
Answer by juliochassan · Oct 22, 2020 at 11:07 PM
the first script will be in the Game Manager, make a new scrip name GameManager and unity change automatic the icon of this scrip for a gear icon and this going to run before any others
public class GameManager : MonoBehaviour{......}