Weird Script behaviour
I Am Having an issue with a script I am working on...
Let me tell you the details first ;
My problem is a reference not set as an instance, concerning a int[] (not public nor private) and a public ChosenClass[] (class is public and serializable)
I sincerely dont understand, the int[] is supposed to be accessible by its own script right? And the ChosenClass[] is perfectly fine in the inspector.
(btw both are set by default as new int[0]/ChosenClass[0])
And here is where it gets weird, the problem is only happening on START of the game (yet in the script's update method) If the concerned object is not selected.
selecting it at any point miraculously fixes the issue... How is this a thing?
How is the script not cooperating if not on the inspector a start?
PS: the script does not even have anything to do with the editor.
Answer by jmailloux11 · Aug 09, 2020 at 08:45 PM
Guys I fixed it, turns out classes have a weird behaviour when values are not changed through inspector.
I needed to implement a Constructor in the class to allow such changes.