Using Orthello2D, I am trying to create a OTSpriteAtlasCocos2D at runtime. My intention is to create this object, then attach a texture and AtlasDataFile to it as per what I see in the inspector and also from the how-to info:
http://www.wyrmtale.com/orthello/sprite-containers
The problem I am running into is that I am getting a null reference exception right away and I cannot even get to the point of wiring up a texture. I am trying to create it like this:
OTSpriteAtlasCocos2D testAtlas = OT.CreateObject("OTSpriteAtlasCocos2D").GetComponent<OTSpriteAtlasCocos2D>();
I set a breakpoint after it, and when I run inside the editor it always crashes out with a nullreference exception at this line. I have tried to set this testAtlas as a public OTSpriteAtlasCocos2D, and then from the inspector drop in an existing Sprite Atlas that I made for testing, but when I inspect the variable at runtime it is always null even though I clearly dragged and dropped my working atlas onto the public testAtlas field.
I don’t care which approach I take (public var with dropping the container on it, or creating the whole thing from scratch in code), but I am getting stuck on both fronts. What am I missing?