大佬们, 反映3个v2.3.0.-rc3 的问题
1: cocos creator VsCode 游戏断点无效 -Debug 断点功能失效。。
2:一个材质问题:
TypeError: Cannot read property ‘define’ of null
at cc_Material.define (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:21802:22)
at TerrainSurfaceRender.BaseTrRender.customMaterial (http://localhost:7456/preview-scripts/assets/Terrains/BaseTrRender.js:147:26)
at SpawnTrBase. (http://localhost:7456/preview-scripts/assets/Terrains/SpawnTrBase.js:145:20)
at http://localhost:7456/preview-scripts/assets/Terrains/SpawnTrBase.js:171:21
at CCLoader. (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:34764:29)
at http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:34654:32
at http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:45217:11
cocos2d-js-for-preview.js:21802
TypeError: Cannot read property ‘define’ of null
at cc_Material.define (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:21802:22)
//////Code////
//override
_activateMaterial () {
let material = this.sharedMaterials[0];
if (!material) {
this.disableRender();
return;
}
//material = cc.Material.getInstantiatedMaterial(material, this);
material = cc.MaterialVariant.create(material, this);
this.setMaterial(0, material);
this.markForRender(true);
}
customMaterial(effectAsset) {
if (effectAsset) {
//实例化一个材质对象
let material = new cc.Material();
//在材质对象上开启USE_TEXTURE定义
let defineUserTexture = !!effectAsset.shaders.find(shader => shader.defines.find(def => def.name === 'USE_TEXTURE'));
if (defineUserTexture) {
material.define('USE_TEXTURE', true);
}
//为材质设置effect,也是就绑定Shader了
material.effectAsset = effectAsset
material.name = effectAsset.name;
//将材质绑定到精灵组件上,精灵可以绑定多个材质
//这里我们替换0号默认材质
this.setMaterial(0, material);
//从精灵组件上获取材质,这步很重要,不然没效果
material = this.getMaterial(0);
//if (material.effect._properties.brightness) {
//material.effect.setProperty('brightness', 0.35);
//}
}
this._activateMaterial();
}