Quantcast
Channel: Questions in topic: "exception"
Viewing all articles
Browse latest Browse all 470

NullReferenceException with serialized array

$
0
0
Hello! I have a script with arrays of serialized objects like this: [Serializable] public class GenerationZones {public GeneratedObjecct [] GeneratedObjets = new GeneratedObjecct[100]; public int PositionX = -1; public int PositionZ = -1; public int State = 0; public int GeneradedObj = 0;} [HideInInspector] public GenerationZones [] GenZones = new GenerationZones[100]; When i hit play in a scene where the script is working everything is ok. But when i hit play in another scene and then i enter a scene with this script, it's not working. On every call to GenZones[n] (or any another same element) the game throws 'NullReferenceException: Object reference not set to an instance of an object'. What can be wrong?

Viewing all articles
Browse latest Browse all 470

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>