Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

Creator 脚本互相调用,获取不到对方的变量

$
0
0

@406504302 写道:

脚本A

cc.Class({
extends: cc.Component,
properties: {
speed: 1
},

onLoad: function () {

}

});

脚本B

var a = require("A");
cc.Class({
extends: cc.Component,
properties: {
speed: 1
},

onLoad: function () {
 cc.info(a.speed);

}

});

打印内容: undefined

参考:http://www.cocos.com/docs/creator/scripting/modular-script.html

帖子: 3

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>