this = null ..

Hi everybody,

I’ve come across some weird behavior with unity today - I’m getting this returning null in one of my scripts, which is the first time I’ve ever experienced this being something other then… well… this.

The Debug.Log outputs "Landscape constructor. this = null in the console.

public class Landscape : Object
{
	public Landscape(LandscapeFactory aLandscapeFactory)
	{
		_LandscapeFactory = aLandscapeFactory;

		Debug.Log("Landscape constructor. this = " + this);
		SetupInitialTiles();
	}

I do realize that this class is extending Object instead of MonoBehaviour, but surely this should not be the cause?

Much thanks! :slight_smile:

…Just tried extending from ScriptableObject instead of Object and that fixed the issue. Still unsure on why though…