List initalises with thousands of null entries

I Initalise a List using
private List<Room> roomsList = new List<Room>();

I have looked at the documentation and stepped through the code but for some reason this list consistently initalises with thousands of ‘null’ entries. Not always the same number of entries though. (5276 entries, 5718 entries, 5966 entries). I’m thinking it’s possibly something wrong with the clean up of code after each use of the program, but I’m really not sure.

Yet when I do this exact same code later on in the program private List<Doorway> doorWayList = new List<Doorway>(); this initalises with no entries (Which is what I expect).

If you have any ideas I would be hugely appreciative.

Thanks

I’ve found the answer. Really was a classic case of come back to it and it’s obvious!

After trying as Destolos has suggested to put it into an Awake function I realised that Awake wasn’t being called. This was because of how I never actually instantiate the class that holds the list of Room.

I’ve now got a simple initalise function and the list correctly initalises now.

I had no idea that Unity didn’t do the assignment if the class was never created. Something new every day. Thanks for the help!