Cocos2D-Mono 2.10.0 is now out!

Cocos2D-Mono 2.10.0 moves to MonoGame 3.8.6.1 and brings a month of fixes. Labels on Linux and macOS now draw at the size and spacing Windows uses, and every platform draws each glyph whole. Loading textures and content on another thread no longer races the game thread, and the scenes you leave can be freed. No public API went away, so the engine's changes don't stop your game compiling, but a game that references MonoGame itself has to move to 3.8.6.1 too. The release notes have the full rundown.
MonoGame 3.8.6.1
The packages now build on MonoGame 3.8.6.1, with MonoGame's fixes from 3.8.6 and 3.8.6.1. Among them, on DesktopGL, clearing the screen or a render texture clears all of it even while a scissor rectangle is set, as XNA did. And a disposed render target, such as the one behind a CCRenderTexture, can now be garbage-collected.
If your game references MonoGame directly, as projects made from our templates do, move it in step:
- Set every MonoGame package reference, such as
MonoGame.Framework.DesktopGLandMonoGame.Content.Builder.Task, to 3.8.6.1. With an older one, NuGet stops the restore with error NU1605, a package downgrade. - Move the MGCB tools in
.config/dotnet-tools.jsonto 3.8.6.1 as well, so your content builds with the same MonoGame. MGCB 3.8.6.1 can't import TIFF images, so convert any to PNG first. - On WindowsDX, MonoGame no longer brings in
SharpDX.Mathematics. If your game uses its types, such asSharpDX.Color4, reference that package yourself.
<PackageReference Include="Cocos2D-Mono" Version="2.10.0" />
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.6.1" />
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.6.1" />
Labels on Every Platform
CCLabel draws a TTF font's glyphs with each platform's own text renderer, and those renderers didn't agree. Several also cut glyphs short:
- Linux and macOS. Text came out about half as tall as on Windows, but spaced for its full size, with wide gaps between the letters. Full stops, commas, hyphens and underscores disappeared, accents above capitals were cut off, and lines sat less than half as far apart as on Windows. Labels there now draw at the size and spacing Windows uses, taking the font size in points. So if you chose your label sizes on Linux or macOS, you may want smaller ones.
- Windows. Both backends looked for a glyph's pixels only in the box the text renderer lays it out in, and both renderers draw some glyphs past that box. With DesktopGL, ink above the top of the line was cut off, like the acute on Ǻ. With WindowsDX, glyphs that reach past their advance lost an edge: at 56 points, Times New Roman's f lost 7 pixels of its hook. On both, combining accents lost some or all of themselves.
- Android. About half of each glyph's first column was cut off.
- iOS, Mac Catalyst and tvOS. Each glyph was drawn a pixel narrower than it is, and usually blurred.
- Everywhere. A space drew a faint dot just below the line, and some glyphs had a faint line along one edge, taken from the glyph beside them in the label's atlas.
Each glyph now has a transparent pixel all around it in the atlas, and nothing is shifted or trimmed. So the atlas holds fewer glyphs before it starts a new one. If your game shows a lot of text, CCLabel.SetTTFAtlasTextureSize makes the atlas bigger. On iOS, Mac Catalyst and tvOS, keep its sizes to powers of two up to 2048.
Safer Threads
CCTextureCache.AddImageAsync loads a texture on another thread while the game carries on. That thread and the game thread shared more than they safely could:
- A load's callback could be lost, because the loading thread scheduled it while the game thread walked the same timers.
- Looking up, removing or purging textures during a load raced it, and a load requested just as the loading thread finished could wait forever, along with every load after it.
- Loading content on the game thread during an async load could corrupt the content manager for good. Every load after that threw
InvalidOperationException. - Adding a file that an async load was already loading loaded it twice, and only one of the two textures stayed in the cache.
All of those are fixed. Callbacks now run on the game thread at the end of the next update, a frame sooner than before, and the texture cache and the content manager take a lock wherever they read or change what they've loaded. CCTask.RunOnScheduler and RunAsync's callback had the same race. They now go through a queue that the game thread runs at the end of its next update. One rule comes with the fixes: change CCContentManager.SearchPaths and SearchResolutionsOrder before you load content on another thread.
Freeing What You Leave
Purging the caches after leaving a scene now frees that scene's assets. RemoveUnusedTextures, RemoveUnusedSpriteFrames and CCSpriteSheetCache.RemoveUnused each kept the last entry they looked at, whether anything used it or not. That was usually the newest, so a scene's own assets were the ones left behind. The scheduler and the action manager also kept the last nodes they had updated reachable, and their scenes with them.
CCNode no longer has a finalizer. It ran Cleanup on the garbage collector's finalizer thread, alongside the game thread, and kept every collected node alive for one more collection. The engine still cleans up a node you remove from its parent, and a scene that the director replaces or pops, with all their children. If one of your Cleanup overrides releases something, call Cleanup or Dispose before you drop such a node any other way.
Upgrading
Bump your package reference to 2.10.0, move any MonoGame references as above, and check these:
- Scroll views clip their content. A
CCScrollVieworCCTableViewnow draws only what's inside its view, asClippingToBoundsalways said it did. If you relied on content drawing outside the view, setClippingToBoundsto false. - Labels on Linux and macOS are about twice as tall, as described above.
- The garbage collector no longer cleans up nodes, as described above.
- Some fixes change what existing code does:
- Colour and opacity set through a
CCNodereference, asCCColorBlendAnimationsets them, now change layers and labels. Before, such a call didn't change what they drew. CCTask.RunOnScheduler,RunAsync's callback andAddImageAsync's callbacks run a frame or two sooner, andCCTask's don't wait while the scheduler's targets are paused.CCFocusManager.MenuScrollDelayis 250 milliseconds by default instead of 50.
- Colour and opacity set through a
- Mac Catalyst and tvOS from source: our MonoGame fork moved to 3.8.6.1. Check it out again at the commit that
MONOGAME_FORK_REFnames in the engine'sbuild.yml, and rebuild its Mac Catalyst or tvOS project.
Code built against 2.9.1 still runs on 2.10.0. The one new nullable annotation, b2Contact.Create returning b2Contact?, only warns, and only in projects that enable nullable. The CHANGELOG covers every change under Upgrading, Changed and Fixed.
More Fixes
The CHANGELOG lists 26 fixes. Beyond the ones above:
- Box2D.
b2World.StepthrewInvalidCastExceptionwhen an edge or chain shape on a dynamic body met another edge or chain. Box2D doesn't collide those, so now they pass through each other, as they should. - Animations.
CCAnimationCacheignored animation plists in the original format, version 1, and loaded none of their animations. - Focus.
CCFocusManagermoved the focus to the wrong item, or to one that couldn't take it, and on a standard game pad its d-pad handling never moved the focus at all. Now a press moves it at once, and holding the button moves it again everyMenuScrollDelaymilliseconds. - Controls and tile maps. Removing a
CCControl's handlers left every other matching one in place.CCControlButton.SetBackgroundSpriteForStatethrew for a plain sprite when the button had a preferred width. And aCCTileMapAtlasthrew when itsColororOpacitychanged. - Text fields. On DesktopGL, Backspace or Delete in an empty
CCTextFieldTTFthrew on every frame the key was held. - Busy scenes. Scheduling selectors on more than 256 nodes made
CCDirector.UpdatethrowArgumentException.
The fixes come with regression tests, which bring the unit suite to 566.
Full Changelog: https://github.com/Cocos2D-Mono/cocos2d-mono/compare/v2.9.1...v2.10.0
Known Issues
- iOS 27 and Xcode 27. An app built with the Xcode 27 SDK is stopped as soon as it launches on iOS 27, or on macOS 27 as a Mac Catalyst app. UIKit now requires the scene life cycle, and MonoGame's iOS platform doesn't adopt it yet. Building with Xcode 26 avoids it for now.
- Saving a render texture on Apple platforms. On Mac Catalyst, and likely on iOS and tvOS, the next draw after
CCRenderTexture.SaveToStreamfails. CallingBegin()and thenEnd()on a render target after the save works around it.
NuGet Packages
-
Cocos2D-Mono (Windows, Linux, macOS, Android, iOS): Cocos2D-Mono
-
Cocos2D-Mono.Core — same engine, no content-pipeline dependency: Cocos2D-Mono.Core
-
Cocos2D-Mono.Box2D — the Box2D physics port: Cocos2D-Mono.Box2D
The samples package and the Visual Studio project templates move to 2.10.0 and MonoGame 3.8.6.1 too.
What's Next
Cocos2D-Mono now releases once a month, early in the month, with urgent fixes in between, so the next release is due in early January. Further out is 3.0, an API cleanup that has no date yet. If you hit a problem, please open an issue.
Thanks, as always, for being part of it. GO COCOS NUTS!