有些脚本里面写有
const SceneObject = require(‘SceneObject’);
或extends: require(‘SceneObject’),
但是“SceneObject”脚本里面又是个空的。那上面两句是起什么作用呢?
我知道这样的做法是可以用其他脚本(sceneObject.js)里的方法,但是sceneObject.js这里面什么都没写,就只有:
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
},
// use this for initialization
onLoad: function () {
},
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});
那这样有什么特殊作用吗
那就是没有什么作用