- Home /
objects missing from array, on prefab, after updating list name in script
I have a script "BoardManager" on an object prefab "GameManager". A new instance of GamaManager is created at runtime.
This prefab has a GameObject Array called outerWallTiles;
public GameObject[] outerWallTiles;
In the editor, three game objects are attached to the script, on the prefab
I noticed that I had mistakenly capitalized the declaration "OuterWallTiles", so I changed it to "outerWallTiles". I made sure to change it through the entirety of the code. On the prefab, everything looks the same. The 3 game objects are still attached and since the editor changes the name to Outer Wall Tiles regardless of casing, there was no change there either.
However, when I run the program, the prefab instance is missing those 3 game objects, and instead of an array size of 3, the array size is 0. Nothing else has changed and it makes no sense.
This is Unity 5.6.1f1.
Edit: I used Git to revert the changes and it made no difference. the 3 game objects are still missing on instantiation.
Answer by Fragmental · Apr 16, 2018 at 03:34 PM
After shutting down both visual studio and restarting unity a few times, the prefab finally showed an array size of 0. I changed it to 3, and added the game objects and now everything seems fine again.
I'm guessing that, when I changed the name of public GameObject[] outerWallTiles;
, it should have reset the array to a size of 0 in the inspector, on the prefab, but for some reason that didn't happen.
I even tried resetting it myself and it didn't seem to make a difference. I have no idea why this happened. It could have been a bug in this particular version of Unity.
Your answer
![](https://koobas.hobune.stream/wayback/20220612160857im_/https://answers.unity.com/themes/thub/images/avi.jpg)