- Home /
Question by
FiliBu5ter · Mar 13, 2018 at 09:07 AM ·
arrayinspectorarrays
Inspector overring array.
I have a script that initialises the first two members of an array:
public string[] texts = new string[] {"Text1", "Text2" };
However, they are overriden by the inspector when the game starts, since I have the array size set as 1. Is there a way to stop the inspector from overriding the members and array length without making the array private?
Comment
Best Answer
Answer by haruna9x · Mar 13, 2018 at 10:45 AM
You can use the [HideInInspector] attribute to hide it from the Inspector, however it is still serialized. And if the array has been modified before, you need to reset it, this option is right next to the script name.
Or you can make it private. Then write a property plus get and set.
Hello there,
Please accept haruna's answer if it fixed your problem :)