Cocos Creator v2.4.0 is here! This update brings more new features, optimizes performance and improves stability. Efficiency is everything! This version contains many new features and updates, such as resource management system refactoring, asset bundles, optimized the performance of graphic rendering.
It is recommended for all v2.3.x developers to upgrade! Please perform the necessary technical evaluation and backups before upgrading.
If the worker wants to do his best, he must first sharpen his weapon! After two months of testing, version 2.4.0 is finally here! Thanks to all the friends who gave us valuable comments and suggestions!
Support Asset Bundles
Asset Bundle can divide the resources in a project into modules according to the wishes of the developer, and divide the resources with different needs in different scenarios into multiple packages. This reduces the time required to download and load a game for the first time, and can also be copied across projects.
Asset Bundle also provides priority, compression type and other related settings to optimize the package and loading of the Asset Bundle.
cc.AssetManager module for resource management
Asset Manager is newly introduced in Cocos Creator v2.4. It has the function to load resources, find resources, destroy resources, cache resources, asset bundles and so on. Asset Manager has better performance, easier-to-use APIs, and stronger scalability. It mainly provides the following new features:
- Supports loading and pre-loading of all resources, pre-loading can run silently in a lighter way, without affecting operation efficiency.
- Supports Asset Bundles.
- Supports a more secure automatic release mechanism, no need to consider its reference when releasing resources, to avoid mistaken release of resources.
- Support download failure retry, download priority, download concurrent number and other settings, which can be adjusted according to various situations.
- Support more convenient custom loading process to achieve special effects.
Add Label blending options
Supports setting Label’s belnding options, and different settings in different usage scenarios can be used to maximize text rendering performance. For details, please refer to the Blending Mode of System Fonts documentation.
Use FreeType to render Label on native platforms
- Increased Label initialization speed, Android increased by about 5 times, iOS increased by 3 times
- Support bold, outline, shadow and other effects when using
Support Graphic anti-aliasing effects
Using SDF technology to optimize Graphic’s aliasing problem:
Support the compressed texture of other small game platforms
The editor further supports the compression texture limitation of more mini game platforms. Just add the compressed texture format in the Mini Game item to set the compression of multiple platforms including WeChat mini games, OPPO mini games, Vivo mini games, etc.
Improve native hot update support
Cocos Creator v2.4 further improves the native hot update capability and optimize the following:
- Add interface to get update package size
- Add MD5 parameter to the link, more friendly to CDN
- Solve the problem of resource loss and confusion caused by interruption of the update process
Please see this GitHub issue.
For details, please refer to the Hot Update Sample Tutorial.
Added SafeArea UI component
This component will adapt the layout of the node where it is located to the safe area of the mobile phone with a special screen. It can be adapted to Android and iOS devices. For details, refer to the SafeArea Component documentation.
Other new features
- Add compressed texture cache function, cache the compressed texture after construction, and reuse the cache content as much as possible to speed up the construction speed
ImageBitmapto load images on the Web platform, improve the preview and Web platform image resolution speed, and reduce the stutter during loading
- Editor property panel supports drag and drop array assignment
- Upgrade TypeScript version to 3.9.2
- Upgrade the V8 version of the native platform to 8.0.426.16
- Support importing GLTF resources
- Support the first scene subcontracting function on all small game platforms
- Support module culling during preview, improve preview speed, and expose module culling settings earlier
- Optimize the performance of free and relative modes of 2D particle system [#6236]
- Optimize the efficiency of
- Increase the bandwidth of the native platform WebSocket [#2353]
SpriteFrameresource adds a
Nonetrim type, which can be quickly set to no crop.
- Improve the code hints of
- Support setting preview port
- The window size can be set when the native desktop platform is built
- [CORE] Fixed the issue that the return value of
cc.easeBackOutis incorrect when time is 0, [#6728], (thank you chen-gaoyuan)
- [CORE] Fixed the issue of
Node.walktraversal error [#6710]
- [CORE] Fixed the error of calling
- [CORE] Fixed the issue of setting node
sizein onLoad is invalid [#6688]
- [CORE] Fixed the issue of resetting the background material back to the default material when the button is disabled [#6562]
- [CORE] Fixed error when BMFont configuration data does not exist [#6472]
- [CORE] Fixed the issue of invalid transparency after pre-multiplication is enabled [#6451]
- [CORE] Fixed the issue of
Camera.render()rendering twice, [#6355], (thank you Dacheng Xiaofa)
- [CORE] Fixed the issue of picture flip after calling
- [PARTICLE] Fixed the 2d particle system relative mode, the particle follows the problem when the node rotates [#6236]
- [3D] Fixed the problem that 3D Label is not displayed in char mode [#6882]
- [3D] Fixed the problem of rendering error caused by checking the option
Enable Auto Batchand switching Mesh resources [#6901]
- [3D] Fixed the problem of rendering the shadow of a single camera misaligned [#6477]
- [3D] Fixed the issue of
cc_matProjerror in effect [#6653]
- [EDITBOX] Fixed the issue that the EditBox.maxLength attribute does not take effect in number mode [#6725]
- [EDITBOX] Fixed the issue that the EditBox could not update the position when scrolling in ScrollView [#6634]
- [TILEDMAP] Fixed the possible rendering order of Tiled Map may be wrong [#6284]
- [TILEDMAP] Fixed the problem that the hidden image of Tiled Map will still be rendered [#6309]
- [SPINE] Fixed Spine texture rendering error after using compressed texture [#6483]
- [SPINE] Fixed the issue that Spine texture may render incorrectly [#6584]
- [SPINE] Fixed the issue that DragonBone and Spine render incorrectly after the texture is set to pre-multiplied [#6696], (thanks Dacheng Xiaofa).
- [DRAGONBONE] Fixed the issue that DragonBone keeps reporting errors when destroying scenes [#6553]
- Fixed the problem of incorrect node scaling after screen flip [#6689]
- Fix Android native
JniHelperis not thread safe [#2457]
- Fix the issue that
unzipis not thread safe [#2131], (thanks benloong)
- Fix the problem that the Edit button of Android EditBox is blocked by the virtual navigation bar [#2426]
- Fix the problem that Spine node can not get the node size on iOS [#273]
- Fix the issue of
cc_timeerror in native Effect [#6586]
- Fix the possible crash of iOS audio playback [#2358]
- Fix the problem of node rotation calculation error [#2361]
- Fixed the crash caused by encoding error when setting
- Fixed an error when the game exited [#2406]
- Fix the problem that the input box will push up the view after the screen is rotated [#2415]
- Fix the problem that the path animation in the JSON file exported by Spine 3.6.53 failed to parse [#2413], (thanks to laomoi)
- Fix the problem of gravity sensor error on Android [#2231]
- Fix Tiled Map will not be rendered when the node moves to a location without plot information [#2283]
- Fix the problem that the original WebSocket interface is inconsistent with the Web [#2297]
- Fixed an issue where calling Camera’s render method would cause Spine to speed up playback [#258]
- Fixed an issue where the AudioSource module was removed due to the removal of the AudioSource module on the Android platform
- Fix Android 9, Android 10 version number detection failure [#6466]
- Fix the issue that audio cannot be played after removing the headset from iOS Web-Mobile [#6730]
WebViewtransparency error on iOS [#6717]
- Fix the problem that English can no longer be input after entering Chinese on iOS browser [#6631]
- Fixed the issue that the WeChat mini game WebSocket sends an error report of
- Fixed the issue that playback cannot be resumed automatically when audio is interrupted unexpectedly [#118]
- Fix the problem that PC WeChat data open domain cannot run
- Fix the problem of incorrect save and restore status of Sprite Editor
- Fixed an issue where animation clips that are not being edited cannot be renamed in animation editing state
- Fixed an issue where the editor could not recognize after adding Spine resources
- Fixed the issue that the editor may not open after the user plug-in restarts
- Fixed an issue where the return value of
getNativeAssetPathswas called multiple times incorrectly
- Fix the problem that the script fails to load after the script is renamed
- Fixed an issue where width and height will be reported incorrectly when clicking on the gallery
- Fixed the issue that the picture may be distorted when using Auto Atlas
- Fixed an issue where importing some pictures caused the resource panel error
- Fixed the problem that the node cannot be deleted by delete key in Prefab edit mode
- Fixed an issue where Filter Unused Resources was not valid when the atlas was not exported
- Fix the problem that the value range of the macro defined in the effect is invalid [#6616]
- Fixed an issue where the animation editor setting
CircleCollider.offsetattribute is abnormal [#6600]
- Fix the problem that the last save is invalid
- Fixed the issue of invalid setting preview browser
- Fix the problem of error report when importing Cocos Studio project without font resources
- Fixed an issue where multiple openings may cause editor errors
- When using remote Asset Bundle and checking Lazy loading, the audio may not be played. Please use
cc.assetManager.postLoadNativeto load and play.
Upgrading a project from a previous version of Cocos Creator is irreversible. Please backup the old version of the project before upgrading.
Projects under development can usually be upgraded seamlessly, but because of the uniqueness of each project, developers should conduct a technical evaluation based on their project’s own needs. If developers encounter difficulties in upgrading, please feel free to give us feedback and we will try our best to assist. In addition, due to stability considerations, it is recommended that projects that are about to be launched or already launched be upgraded with caution.
Upgrade from <2.4.0 version
cc.loaderis no longer recommended, please use the latest
cc.assetManagerinstead, please refer to the Resource Management Module Upgrade Guide
- The sub-package function has been upgraded to Asset Bundle, please refer to the Resource Subcontract Upgrade Guide
- Adjusted the directory structure after the project is built and adjusted the API of
BuildResults. If you use the editor plug-in to get the editor’s build results, please refer to Customized Project Build Process Upgrade Guide
cc.RawAssetthat was deprecated since 1.10 has been officially removed, please use
cc.Assetinstead. Since 2.4 is no longer compatible with the legacy usage of the RawAsset type in the original 1.x project, it is recommended that all projects to be upgraded to 2.4, especially those upgraded from version 1.9, be edited in any 1.10 ~ 2.3 version. All warnings or errors output when the compiler compiles the code are processed correctly, and then upgraded to 2.4.
cc.Color.fromHexis deprecated, please use
Upgrade from < 2.3.3 version
CCTexture2DRGBmethods in the Effect have been abandoned.
Vec3.FRONThas been abandoned, please use
Upgrade from < v2.3.0 version
Since v2.3.0, Android and Android Instant use the same build template, please note:
- If the code is used solely by the Android platform, please put it in the
app/srcdirectory, and the third-party library used by itself, please put it in the
- If the code and third-party libraries used by Android Instant are separate, please put them in the
- For code and third-party libraries shared by Android and Android Instant, please place them in the
libsdirectories under the
proj.android-studioroot directory, respectively.
proj.android-studiounder the root directory
jni/CocosApplication.mk, mainly used to configure engine-related configuration, developer configuration, it is recommended that Android be placed in
app/jni/Application.mk, Android Instant, please put in
- When Cocos Creator compiles for Android, it will execute
assembleRelease/Debugby default, and when compiling for Android Instant, it will execute
In addition, when Cocos Creator compiles for Android, it will execute
assembleRelease/Debug by default, and when compiling Android Instant, it will execute
If you have customized the pause logic when switching between audio background and background, please remove it after upgrading to 2.3.0 Currently Cocos Creator games automatically pause and resume audio internally when switching between front and back on all platforms. If the developer has customized this block before, and listens for and performs audio operations like
resume(), it may conflict with the engine’s default behavior. If you encounter related audio issues, simply remove the corresponding custom code.
Upgrade from version v2.0 – v2.3.0
Starting from 2.3.0, the Canvas component is no longer responsible for setting the Canvas node size to the screen size. This behavior will be implemented in conjunction with the Widget component. To ensure compatibility, after the 2.0 project is upgraded, the node where Canvas is located will automatically add Widget components. (No problem upgrading from a 1.0 project)
Upgrade from < v2.2.0
Starting from 2.2.0, we have strengthened the memory management mechanism, and now require users to dynamically create
cc.Node which is independent of the scene node tree through code must be released through
destroy(), otherwise the engine cannot know when to recycle this type The memory of the node will cause a memory leak.
- In addition, the nodes that are manually removed from the scene need to be unified when they are not needed.
// Assuming testNode is a node in the scene, if it was manually removed //from the scene before, such as testNode.parent = null; // or testNode.removeFromParent(true); // or parentNode.removeChild(testNode); // If testNode will be used again in the future, there is no need to // manually destroy the node otherwise it should be called manually testNode.destroy();
- If a node is managed via
cc.NodePool, it is not affected.
Upgrade from < v2.0
If you open the 1.x project, all resources such as scenes will be upgraded automatically. If there are warnings or errors in the code, you can refer to v1.10.0 Resource Upgrade Guide and the v2.0.0 Upgrade Documentation.