Here you can find descriptions of some of the main classes and interfaces of cocos2d-unity. All the api of cocos2d-unity is the same with cocos2d-objc, so you can check the API documents of cocos2d-objc for more detail.


                    //base node of cocos2d
                    CCNode node = new CCNode();
CCSprite & TexturePacker

You can create CCSprite from frame name or path to image file under Resources

                    CCSprite spt = new CCSprite("Frame name or path");

Usage of TexturePacker (3.3.1 is our recommended version.)

                    //suppose you export the data files of texturepacker to "Assets/Resources/images/demo.png"
                    CCSpriteFrameCache.sharedSpriteFrameCache.addSpriteFramesWithFile ("images/demo");
                    CCSprite spt = new CCSprite("demo_ID10.png");

If you pack your images with POT, you can choose the compressed format, but it will lose the quality of image.


                      //fontName : "Arial" or path to ttf/otf under Resources. eg."fonts/Marker Felt.ttf"
                      CCLabelTTF label = new CCLabelTTF(aText, fontName, fontSize);

                        //You can use scale, fade, ease actions like you do with cocos2d-objc.
                        CCMoveTo mv1 = new CCMoveTo (0.5f, new Vector2(100, 100));
                        CCMoveTo mv2 = new CCMoveTo (0.5f, new Vector2(100, 100));
                        CCAction act = CCSequence.Actions(mv1, mv2);

CCTMXTiledMap is not implemented. Use CCTMXParser instead.

                        //suppose the tmx files is under "Assets/Resources/maps/map.tmx"
                        //a txt file with the same name will be created, like "map-tmx.txt"
                        CCTMXMap map = CCTMXParser.Parse ("maps/map-tmx.txt");
                        //get the tiled layer
                        CCTMXTiledLayer layer = map.getTiledLayer ("tiledLayer");
                        CCTMXTile[][] tiles = layer.tiles;
                        //get the object group
                        CCTMXObjectGroup group = map.getObjectGroup ("objectGroup");
                        List<CCTMXTile>  objects = group.objects;
                        //get the tile file and properties
                        string tileFile = tile.file;
                        string property = tile.getProperty ("property");

Only CSV tiled layer format is support.

The tileset should be packed by TexturePacker. Tiles in a same tileset should be same size.


                        //play bgm
                        SimpleAudioEngine.sharedEngine.playBackgroundMusic ("bgm.mp3", true);
                      	//play sound effect
                       	SimpleAudioEngine.sharedEngine.playEffect ("sound.mp3");
3d support

                        //load your fbx prefab
                    CC3FbxGeneric hero = new CC3FbxGeneric("your fbx prefab");
                    addChild (hero);
Unsuported Features