Can't load TMX file via CCTMXTiledMap

Topics: Content Building and Deploying, iOS
May 3, 2014 at 1:42 PM
Edited May 3, 2014 at 1:43 PM

i am currently developing with Xamarin.Studio and a Mac.

My game crashes while initializing the CCTMXTiledMap.

I set the content directory in the Game.cs:
Content.RootDirectory = "Content";
and initialize the map in the GameLayer-Constructor.
_tileMap = new CCTMXTiledMap("Maps/CatMaze.tmx");
When the code arrives this line, there's an exception being thrown saying:
Microsoft.Xna.Framework.Content.ContentLoadException: Failed to load the asset file from Maps/CatMaze.tmx
at Cocos2D.CCContentManager.Load[String] (System.String assetName, Boolean weakReference) [0x00130] in /Users/myname/cocos2d-xna/cocos2d/Platform/CCContentManager.cs:239
at Cocos2D.CCContentManager.Load[String] (System.String assetName) [0x00028] in /Users/myname/cocos2d-xna/cocos2d/Platform/CCContentManager.cs:185
What did I do wrong? Do I need a content pipeline? I thought for MonoGame-only solutions there's no need for one.

Thanks in advance!


mollywood nini
May 5, 2014 at 4:43 AM
Make sure your content is being marked as content and set to be copied to the output directory.

As for MonoGame - the need for content building is not a function of whether or not you are using MonoGame. MG will support XNB content files or raw stream files. I am not sure that the TMX file will load as a raw asset. That would depend on how the MG runtime content manager sees the asset file when it tries to load the binary data.