//第一个节点从pb_test实例化
var node = cc.instantiate(this.pb_test);
node.parent = this.node;
node.setPosition(100,100);
//第二个节点也是从预制资源进行pb_test实例化。
var node2 = cc.instantiate(this.pb_test);
node2.parent = this.node;
node2.setPosition(200,200);
//第一个节点置灰
var spriteFrame = node.getComponent(cc.Sprite).spriteFrame;
spriteFrame.getTexture()._switchToGray(true);
代码如上:输出结果,第二个节点也会变成灰态。查看相关API有以下解释:
求高手给与解答下。怎么解决。预制资源可以序列化吗?
