Cocos Creator v2.4.9 focused on fixing some 2.x related problems recently discovered, focusing on improving the stability of the editor and engine. And solved some of the obstacles affecting games published on the native mobile platform. It is recommended that all 2.x users upgrade. This version has not broken the compatibility of projects and plugins. Please refer to the upgrade instructions of 2.4.7 to update.
We will continue to deliver critical bug fixes in 2022, as announced during the 3.0 general release. These fixes will only be optimized around stability and usability, so it is no longer recommended for new users or new projects to choose 2.4. Please use the 3.x version for development.
Stack Changes
- Upgrade okhttp to 3.12.14 to avoid compatibility issues when publishing to Google Play [#4264].
- Upgrade OpenSSL to 1.1.1g to avoid compilation problems with NDK 22 [#4282].
Editor
- Fixed an issue that the building process may get stuck on some Mac devices.
- Fixed an issue that the compiling process fails with app bundle option checked when building package for Android platform.
- Fixed an issue that some error occurred when building a package for Google Play Instant.
- Fixed an issue that the scale of the parent node of the Main Camera can not be animated in Animation Editor.
- Fixed an issue that some error occurs when returning to a scene with 3D particles from the Prefab editing mode.
- Fixed an issue that the simulator cannot be open after setting custom resolution with float point number in Preferences.
- Fixed an issue that some part of the panel is obscured after moving panel in some cases.
- Fixed an issue that rendering artifact occurs after switching skins of Spine component in the editor [#10343].
Engine
- Adapt the high-performance mode of WeChat mini-games [#10160].
- Fixed an issue that the rendering data remains after calling reset API of particle system component[#10088], thanks to caogtaa
- AudioEngine added isPlaying API [#9372], thanks to 大城小胖.
- Optimized the rendering of the MotionStreak component [#9693].
Native
- Remove some functions called on the iOS platform to avoid Apple Review Rejection[#4275]
- Fixed an issue that the game crashes when switching to night mode on the Android phone toolbar [#4276]
- Fixed an issue that the JNI error occurs after calling callStaticMethod several times [#4162].
- Fixed an issue that nodes added with addUserNode of TiledMap component are displayed inconsistently between native and web platforms [#4274].
- Fixed an issue that the game crashes when getting the data property of event object when the event of DragonBones component emitted on the native platform [#4273], thanks to LincolnLiuXinbing
- Fixed an issue that the SpotLight component can’t cast shadows [#4257], thanks to haha-yu.
- Fixed an issue that the EditBox component will hide the keyboard when sliding to select words [#4170].
- Fixed an issue that the Video Player component can’t play videos within the subdirectory of the data folder [#4045].
- Fixed an issue that the game crashes when using the Mask component on some devices [#4279].
Upgrade Tips
As Cocos Creator 3.0 version has been officially released, v2.4.x will be used as the LTS (long-term support) version, providing continuous updates for the next two years! In 2021, 2.4 will continue to be updated to provide bug fixes and new mini-game platform support to ensure the successful launch of your project; in 2022, we will continue to provide developers with the key to 2.4 Bug fixes to ensure the smooth operation of online games! therefore:
- Existing 2.x projects can continue to develop without compulsory upgrade to 3.0.
- For new projects, it is recommended to use version 3.0 for development. We will continue to optimize the development experience and operating efficiency of 3.0 to support the smooth launch of heavy games of different categories such as 2D and 3D.
Upgrading a project from a previous version of Cocos Creator is irreversible. Please backup the old version of the project before upgrading.
Most projects can usually be upgraded automatically, but because the project is inevitably unique, developers should try and evaluate the new version of the engine in advance according to the needs of the project. In addition, due to stability considerations, it is recommended that projects that are about to go online or already online should be carefully upgraded. The following is the upgrade instructions. If developers encounter difficulties during the upgrade, please give us feedback and we will try our best to assist.
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 .
Downloads
Download Creator from Dashboard
Cocos Dashboard
The Cocos Dashboard serves as a unified downloader and launch portal for Cocos Creator. 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: