✅ Object is null after initializing
Hello, I have a object I make
WorldRegions region = new WorldRegions(i, 1)
{
RegionStartTile = startTile,
Width = randomXSize,
Height = randomYSize
};
Yes this object is null when referenced, and null when in watch in debug. I'm not sure why anyone able to explain what is happening?
9 Replies
can u show a screenshot of where it says its null?
Sure.
Here is in Visual Studios on watch

ur breakpointing before the object is getting initialized
altho the object does look initialized to me, its not null
I step through it but I figured it out. I had monobehaviour on it when I didn't want it to be.
Oh, Unity?
yea. Probably should have said that.
Is WorldRegion your own class?
Also it’s “null” not null which would indicate something is setting its value to that elsewhere - I suspect it’s something in the class
$close
If you have no further questions, please use /close to mark the forum thread as answered