I have two instances of same script. I am trying to set entity of another script from my script. For example:
var Script1 = pc.createScript('script1');
Script1.attributes.add('currentObject', { type: 'entity' });
Script1.attributes.add('anotherEntity', { type: 'entity' });
// initialize code called once per entity
Script1.prototype.initialize = function() {
this.anotherEntity.script.Script1.currentObject= this.currentObject; //this is not working
};
As you can see, I am trying to set the currentObject entity of the anotherEntity’s script. How do I do this?