Tiledmap mapsize and tilesize are empty/don't exist

Hey, when I create a tilemap in my project the tilesize and mapsize variables are empty. I first got an EXC_BAD_ACCESS while using _tileMap->getMapSize().width and I then set a few breakpoints and looked at the values of this->_tileMap->_mapSize and saw that they are empty or don’t exist.

I create my map in the init function like this:
auto _tileMap = TMXTiledMap::create("background.tmx"); this->addChild(_tileMap, 0);

The map loads and displays successfully.

I have version cocos2d-x-3.10.

Prob remove the auto keyword, and make sure _tileMap is actually a member of this’ class. _tileMap must not exist where you’re asking for map size.

1 Like

the auto keyword released the values…

Thank you!