Cocos Creator Resources - (UPDATED October 2019)

Cocos Creator Helpful Resources

note: a Chinese language version can be found here

Videos

PR’s

1. cocos creator Rotating 3d node gimbal deadlock problem

PR: valueType add rotateAround func (#4642) · cocos/cocos-engine@581ef38 · GitHub

2. repairing spine using multiple skins, not showing problems in cache mode

PR: fix spine use multiple skin and use cache mode, won’t renderer bug by sunnylanwanjun · Pull Request #4091 · cocos/cocos-engine · GitHub

3. 2.0.10 Label is 2.0.9 Carton

PR: native returns unpremultiplied data by minggo · Pull Request #1765 · cocos/engine-native · GitHub

4. Fixed a problem with cc.tween value of 0 may not work

PR: fixed cc.tween by 2youyou2 · Pull Request #4790 · cocos/cocos-engine · GitHub

5. 2.1.1 Using the ray to detect the basic 3D object (cuboid), the detection distance will be affected by the scaling value

PR: fixed raycast return wrong distance when nodes are scaled by 2youyou2 · Pull Request #4562 · cocos/cocos-engine · GitHub

6. bmfont memory leak

PR: Optimize memory issues of BMFont. by caryliu1999 · Pull Request #4651 · cocos/cocos-engine · GitHub

7. Cocos Creator 2.0.9 ttf font causes memory leak on iOS devices

PR: fix memory leak in loading font on iOS/mac by minggo · Pull Request #1752 · cocos/engine-native · GitHub

8. creator 2.09 WeChat game can’t be closed on background music

PR: fix repeatly recycle audio by PPpro · Pull Request #4793 · cocos/cocos-engine · GitHub

9. spine adjusts the native function BUG via JSB

PR: V2.2.0 spine 3.7 by sunnylanwanjun · Pull Request #1754 · cocos/engine-native · GitHub

10. spine adjusts the native function BUG via JSB

PR: V2.2.0 spine 3.7 by sunnylanwanjun · Pull Request #1754 · cocos/engine-native · GitHub

11. loadResArray has no callback after the network image fails to load multiple times

PR: fix issue that loadRes doesn't callback by holycanvas · Pull Request #4501 · cocos/cocos-engine · GitHub
fix issue that loadRes doesn't callback by holycanvas · Pull Request #96 · cocos-creator-packages/weapp-adapter · GitHub

12. 2.0.10 Font display abnormal system font Arial, in the simulator display suddenly big and small

PR: fix misusage of SelectObject and DeleteObject by minggo · Pull Request #1766 · cocos/engine-native · GitHub

13. creator h5 sound mute problem

PR: set webAudio volume immediately by PPpro · Pull Request #4767 · cocos/cocos-engine · GitHub

14. loading large files under the WeChat game, json ios directly flashback

PR: fix issue that fail to load large file as json by holycanvas · Pull Request #101 · cocos-creator-packages/weapp-adapter · GitHub

15. after the UI adds BlockInputEvents, it still eats events

PR: Modify the calculation of renderOrder in EventManager. by caryliu1999 · Pull Request #4522 · cocos/cocos-engine · GitHub
Fix a sorting error when the node have been removed. by caryliu1999 · Pull Request #4710 · cocos/cocos-engine · GitHub
2.0.10: Sync 2.1.2 bug fix to 2.0.11 by knoxHuang · Pull Request #4653 · cocos/cocos-engine · GitHub

Common Problems

1. 2.1.1 Dynamically modify the material map

A: The texture map receives the cc.Texture2D object, so we can add a cc.Texture2D object in the properties panel ourselves.

3c0f58b742338e6279fc3baf9808dac49f19b1e1

spriteFrame can also get its texture2d:

spriteFrame.getTexture()

With the texture, we directly call the api of the material system to modify the texture:

this.material.setProperty("diffuseTexture", this.goldTexture);

setProperty This interface can modify almost all properties on the material.

Test demo: https://github.com/Jno1995/DynamicLoadingMaterial

2. cocos H5 can’t be judged on ios getID

A: Because the touchID of these two platforms is not the same, this needs to be noted.
So touchID can’t be used as the serial number of multi-touch.
You should get:
ab85fae303142fe2231744dac86694fb51ac13a6
event.getTouches().length;
This field is used to detect the number of contacts

3. cocos creator Rotating 3d node gimbal deadlock problem

A: creator3D里对旋转对万向节死锁怎么处理? - Creator 2.x - Cocos中文社区

4. 2.1.0 Update to 2.1.1 sprite.setState cannot be used

A: this.sprite.setMaterial(0, cc.Material.getBuiltinMaterial('gray-sprite');

5. VIVO window.requestAnimFrame Uncaught error

A:


If windows.requestAnimFrame is not initialized, it is assigned a value of 16.

6. button click event invalid

A: This is a bug in version 2.0.10. You need to call it after switching the transparency of the button.
The node’s _onSiblingIndexChanged function refreshes the scene rendering order according to the arrivalOrder.
You can use it like this:
62a5ceb8e39c8b090a567cf5e12650caebfded1a

7. Cancellation of timer failed, timer is still running

A: The reason for this problem is that this.unschedule(callback, target) requires two arguments to specify the timer object that needs to be paused.
callBack must be the same as the callback in this.schedule, anonymous functions do not work.
The target is the environment object of the schedule. If there is any difference, the schedule cannot be stopped normally.
Implementation can refer to: CCScheduler.js -> unschedule

8. How to dynamically switch resources in the editor environment

A: Hello, this requirement now has the following options:
In the editor environment, cc.loader.loadRes cannot load resource files properly, please use cc.loader.load();
Currently, cc.loader.load() can only be loaded into unparsed data files. Currently, the interface for manually constructing bitMapFont is not open in the engine, so the label font cannot be dynamically switched. The current switch can be done dynamically.

  1. the editor environment dynamically switch pictures
var texture2DEnum = cc.Enum({
    null: 0,
    texture_one: 1,
    texture_two: 2
});

cc.Class({
    extends: cc.Sprite,
    editor: {
        disallowMultiple: true,
        executeInEditMode: true,
        menu: "自定义组件/自定义精灵组件",
    },
    properties: {
        defaultSpriteFrameTexture2D: {
            default: texture2DEnum.null,
            type: texture2DEnum,
            displayName: "图片精灵初始贴图枚举",
            notify: function() {
                this.onLoadTexture2DToSprite();
            }
        },
        _oldDefaultTexture2D: null,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},
    start () {
        this.onLoadTexture2DToSprite();
    },

    onLoadTexture2DToSprite () {
        this.defaultTextureUrl = cc.url.raw(`resources/texture_${this.defaultSpriteFrameTexture2D}.jpg`);
        if (this._oldDefaultTexture2D !== this.defaultTextureUrl) {
            this._oldDefaultTexture2D = this.defaultTextureUrl;
            if (this.defaultSpriteFrameTexture2D !== texture2DEnum.null) {
                cc.loader.load(this.defaultTextureUrl, (err, resTexture2D)=> {
                    this.spriteFrame = null;
                    this.spriteFrame = new cc.SpriteFrame(resTexture2D);
                });
            }
            else {
                this.spriteFrame = null;
            }
        }
    }
});


2. When planning to drag the script into the property panel, I want to have a default value, such as fnt or spritframe, just like the button is there, there are three images, so you can drag and drop each script.

This requirement can be solved with the creator’s control library plugin:
Pull the prefab you need to the control library, just drag it out the next time you use it.
6935442a4acf0e0e4453c286364d482f572f7081

9. use cc.loader.loadRes to load cc.BufferAssets type error

A: Sorry, 2.0.x only supports binary, but it is recognized as cc.Asset type. Only the editor above 2.1 will recognize binary as BufferAsset.

10. Is there any way to get all the keel resources in the Creator project?

A:

Editor.assetdb.queryAssets('db://assets/**\\/*',['dragonbones','dragonbones-atlas'],function ( error, results ) {

});

f2ac8537d0da8507cec8f206f1e28bdc4e75d30c

11. Can’t find subpackage xxx

A: Please test the project after it is released.
Subpackaging information cannot be generated during web preview.

12. About videoPlayer is always displayed at the top of the question

A: Refer to the program of this post
Can meet the needs of most browsers. But on the Android WeChat browser you need to do something like this.

13. Problems with nodesPool using nodes that mount Animation components

A: At present, the engine is designed like this. When the node pool is recycled, the action action registered by the node will be removed, but the animation will only pause and will not be eliminated.
So you need to deal with it yourself during playback and replay it from scratch every time.

14. 2.1.1 Invalid on LabelShadow IOS

A: Currently does not support ios

15. ScrollView nested EditBox, use node pool to reuse EditBox problems

A: Mainly the problem caused by this interface.


removeFromParent() This interface will clear the registered events of the node by default.
removeFromParent() can solve your problem by passing in false

16. cdn cache problem

A: This operational problem, our solution is: manifaset put oss, download package put cdn server. Take it away! This problem is also pitted for a long time.
{“version”:“1.0055”,“packageUrl”:“http://cdn.xx.net/xx/fk10055",“remoteManifestUrl”:"http://osscdn.xx.net/xx/fk/project. Manifest”,“remoteVersionUrl”:“http://osscdn.xx.net/xx/fk/version.manifest”}

can also be like this:
{“version”:“1.0055”,“packageUrl”:“http://cdn.xx.net/xx/fk10055",“remoteManifestUrl”:"http://osscdn.xx.net/xx/fk10055/project. Manifest”,“remoteVersionUrl”:“http://osscdn.xx.net/xx/fk10055/version.manifest”} When the code takes the remote manifest and adds the version number to spell it, put the cdn server.

17. Cocos Creator physics engine related issues

A: 1, box2d elastic problem:
Elasticity is a special movement, and the physical system continuously calculates the state and position of the rigid body during the game life cycle. This problem can now be optimized by reducing the precision of the dt parameters passed by the physical system’s update callback.
Find the code in box2d.js and change the code in the red box.


Another option is to turn on a timer that determines if the amplitude is less than a certain value (such as dt) each time it is rebounded, and then manually stop the bounce of the object.
2, 3 belong to the same kind of problem, you can open the friction of the gold rigid body.

18. Editor problem: abnormal opening project

A: Download this DLL repair tool to try to fix.

19. cc.url.raw The path obtained varies by platform?

A: 2. This is normal. This API is just a simple path conversion and does not take into account the file type. In fact, Creator does not have any API or documentation that requires users to directly use the path of suffix xxx.prefab. You should write TestPrefab.json directly if you need it.
(Because Prefab is not a raw asset, only raw assets can use .raw. For normal assets, there is no guarantee that this json will be available because json may merge.)

20. 2.0.2 IOS10 The following can’t run ah

A: 72069eb12311340eea53769bc6ba114788cc808e
According to the latest data today, iOS 9 is already very small. We tried to support it before, but the effect was not good, so I decided to give up temporarily. After that, we will enable the new JS engine on iOS as soon as possible, so as to avoid the platform fragmentation and the probability of supporting iOS 9 at that time.

Demo Projects

The most important source of examples is the Example Collection project template. There are also many demos to show a complete game:

  • Dark Slash basic game loop demo. Special thanks to Veewo Games for authorizing us to use original ‘Dark Slash’ game resources to make this tutorial.
  • UI Demos including multi-resolution supporting menu interface with cool transition animations, a backpack generated by data and prefab and a Clash Royale style navigation menu showcase.
  • Blackjack demo, collaboratively developed with Tencent Games.
  • Flappy Bird clone featuring a sheep.
  • Star Catcher demo game, in user manual we have a quick start tutorial showing how to build this game step by step.
18 Likes

what is difference between cocos creator and cocos studio 2
which should i start with?

1 Like

Creator is a new, unified, game development tool. It uses JavaScript. Lua and C++ are coming.

Cocos Studio was our previous tool and it has now been EOL’d.

1 Like

I’m going to be making a brand new project soon, and am weighing my options with the various game engines. Is Cocos Creator ready for game development now? Are there things that you can’t do with it that are available in cocos2d-x? It seems cool, but I don’t want to be kicking myself when there’s something it won’t let me do. I’m extremely hesitant to use v1.0 software for long-lasting projects. Still, Cocos Creator looks like it’s a fancy GUI over the battle-tested cocos2d-x. If that’s the case, and there’s something that Creator won’t let me do, can I just open the hood and do it with cocos2d-x?

Sorry if this didn’t make much sense. I’m entirely new to this project. Thanks in advance!

There are folks making games with Creator now. But, yes, you can always manipulate your Creator game outside of Creator to a certain extent. I’m not the best person to tell you the extent of this. @pandamicro @nantas2?

2 Likes

Hi, @GoodAndLost, I’ll skip the part about how Creator is good for game design and how we are determined to make it better and better.

To your concern, what it can’t do currently:

  1. We don’t have physics component yet, although you can use chipmunk and box2d, but editing them in the editor is not ready. It’s planed to be finished in summer.
  2. Basic Graphics will be available soon, but not yet.
  3. Performance improvement is scheduled in v1.2 which is the next version.
  4. We support spine, but FFD animation is not supported yet, it will be soon.
  5. We don’t support DragonBones yet.

And welcome to try it out for a demo or something small, then you’ll know better about it.

Besides, I just made a game in a local game jam in Xiamen:

Another one we made in GGJ 2016 is

1 Like

Hey,

I’m looking at http://www.cocos2d-x.org/docs/editors_and_tools/creator/index.html which has a lot of good notes, information and documentation on how to use Cocos Creator (Awesome!)

Now there are some missing pages that say “coming soon” and it’s fine, no rush. It was mentioned in your e-newsletter that English documentation for Cocos Creator v1.4.2 will be updated but I’m wondering how will we be notified of these missing pages when they are filled in? Will there be a “new” label beside the changed pages or will I have to go through each page and see if the coming soon pages are now filled in?

Thanks for all your hard work!

Hi Elias, most of this “coming soon” messages have been there since the documentation was released almost a year ago.

User Manual is way better: https://github.com/cocos-creator/creator-docs/blob/master/source/en/index.md

2 Likes

Thanks!

So I should stop looking at the documentation link I posted?

1 Like

I haven’t checked that link in months. The Creator Manual is the only documentation they are updating so far.

1 Like

Hello, so I wasn’t sure where else to post this but I was reading online about this editor and I was very excited to use it, however whenever I tried to load a project with the editor I received an error in the project’s log - Error: EPERM: operation not permitted, open ‘C:\Program Files (x86)\CocosCreator\resources\static\default-assets\image.meta’. I’m wondering if this has anything to do with the permissions of the program but I’m unsure, any help would be greatly appreciated. Thanks!

1 Like

Hello. I need help. I am working on the Cocos Creator Quick Start: " Creating your first Game." I am stuck on the part where we are “Writing the main character’s script.” 3. The guide asks me to “Right click the scripts folder, choose Create->JavaScript and create a JavaScript script 4. Rename the newly created script as Player. Double click this script and open the code editor.” But, when I double click script Player, I get an error message and no editor pops up. Script: C:\Start project\ start_project\assets\scripts\Player.j Error: Expected identifier, string or number. Source: Microsoft JScript compilation error.
Show less
REPLY

1 Like

The internal editor is no longer there. Use VSCode to write your code.

1 Like

Hi there. Recently, I updated Cocos Creator to versions 1.7 and 1.8. After this, I opened my project (and also tried creating a new one), but instead of loading, I just get the message “Importing assets, please wait”. After waiting many hours, nothing has changed, and this occurs across multiple devices which Cocos Creator is installed on. I have also tried to use an older version, but this doesn’t make a difference as the latest version loads instead. Are there any suggestions for how to fix this? Thanks.

1 Like

Can you show us anything? I am not having this problem.

1 Like

It was happening with me on Windows. I had to right click Cocos Creator and execute as administrator, then it worked.

1 Like

Thanks, @bruno1308, running it as administrator fixed it.

Some super stupid questions:

Sorry for the stupid newbiness to this. I still don’t understand what this means: “unified, game development tool.”

  1. Does Cocos Creator only create JavaScript browser output? Or… does it also create native apps for iOS and Android etc? If so, how are the JavaScript scripts converted to C++ or whatever else they’re made into for running natively on devices?

// I really am asking about NATIVE native apps. Not wrapped web apps or other forms of wrapping HTML output into “native”.

  1. Where can I ask about how this works:

http://docs.cocos.com/creator/manual/en/scripting/class.html