Cocos Creator v2.4.0 released, now using Cocos Dashboard!
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.
Note: Yes, you use Dashboard now to Download and manage Cocos Creator
Downloads
Download Creator from Dashboard
Cocos Dashboard
The Cocos Dashboard serves as a unified downloader and launch portal for Cocos Creator and Cocos Creator 3D engines. Everyone can upgrade and manage multiple versions of Cocos Creator. In addition, unified project management and a creation panel is integrated, which is convenient for everyone to develop projects with different versions of engines at the same time.
Manage projects developed under different versions:
You can choose to use a different version of Cocos Creator when creating a new project:
What’s New
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.
For additional details, please refer to the Asset Bundle documentation and the Load Asset Bundle documentation.
Added 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.
For details, please refer to the Asset Manager documentation and the Dynamic Loading documentation.
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
TTF
font andChar
mode
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.
Release Notes
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
-
Use
ImageBitmap
to 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
Improvements
-
Optimize the performance of free and relative modes of 2D particle system [#6236]
-
Optimize the efficiency of
ToggleContainer
to gettoggleItems
[#6569] -
Increase the bandwidth of the native platform WebSocket [#2353]
-
SpriteFrame
resource adds aNone
trim type, which can be quickly set to no crop. -
Improve the code hints of
jsb
-
Support setting preview port
-
The window size can be set when the native desktop platform is built
Engine
-
[CORE] Fixed the issue that the return value of
cc.easeBackOut
is incorrect when time is 0, [#6728], (thank you chen-gaoyuan) -
[CORE] Fixed the issue of
Node.walk
traversal error [#6710] -
[CORE] Fixed the error of calling
cc.dynamicAtlasManager.showDebug
[#6697] -
[CORE] Fixed the issue of setting node
size
in 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
Texture2D.setPremultiplyAlpha
[#6602] -
[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 Batch
and switching Mesh resources [#6901] -
[3D] Fixed the problem of rendering the shadow of a single camera misaligned [#6477]
-
[3D] Fixed the issue of
cc_matProj
error 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]
Native
-
Fixed the problem of incorrect node scaling after screen flip [#6689]
-
Fix Android native
JniHelper
is not thread safe [#2457] -
Fix the issue that
unzip
is 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_time
error 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
Label.string
[#2395] -
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]
Web
-
Fix the issue that audio cannot be played after removing the headset from iOS Web-Mobile [#6730]
-
Fix
WebView
transparency error on iOS [#6717] -
Fix the problem that English can no longer be input after entering Chinese on iOS browser [#6631]
Mini Game
-
Fixed the issue that the WeChat mini game WebSocket sends an error report of
Uint8Array
[#115] -
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
Editor
-
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
getNativeAssetPaths
was 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.offset
attribute 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
Known Issues
- When using remote Asset Bundle and checking Lazy loading, the audio may not be played. Please use
cc.assetManager.postLoadNative
to load and play.
Upgrade Tips
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.loader
is no longer recommended, please use the latestcc.assetManager
instead, 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 -
The
cc.RawAsset
that was deprecated since 1.10 has been officially removed, please usecc.Asset
instead. 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.fromHex
is deprecated, please usecc.Color.fromHEX
interface
Upgrade from < 2.3.3 version
-
The
CCTexture2D
andCCTexture2DRGB
methods in the Effect have been abandoned. -
Vec3.FRONT
has been abandoned, please useVec3.FORWARD
instead.
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/src
directory, and the third-party library used by itself, please put it in theapp/libs
directory. -
If the code and third-party libraries used by Android Instant are separate, please put them in the
game/src
,game/libs
directories. -
For code and third-party libraries shared by Android and Android Instant, please place them in the
src
andlibs
directories under theproj.android-studio
root directory, respectively. -
proj.android-studio
under the root directoryjni/CocosAndroid.mk
,jni/CocosApplication.mk
, mainly used to configure engine-related configuration, developer configuration, it is recommended that Android be placed inapp/jni/Android.mk
andapp/jni/Application.mk
, Android Instant, please put ingame/jni/Android.mk
andgame/jni/Application.mk
. -
When Cocos Creator compiles for Android, it will execute
assembleRelease/Debug
by default, and when compiling for Android Instant, it will executeinstant: assembleRelease/Debug
.
In addition, when Cocos Creator compiles for Android, it will execute assembleRelease/Debug
by default, and when compiling Android Instant, it will execute in``stant:assembleRelease/Debug
.
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 cc.audioEngine.pause()
and 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.