How do I add type script?

I would like to make my script an atribute on an other script but how I dont know
I found this post but sadly I couldnt find my way in the post on how he had solved the problem

post:

if annyone know how to let me know :slight_smile:

1 Like

yeah i wonder also how i could inplement this inside my coding

dm me if u find awnser

There was no solution, the thread links to a feature request, as it is not currently implemented.

1 Like

Unfortunately the current workaround is to reference the entity and store a local reference to the scriptType

eg

var Test = pc.createScript('test');
Test.attributes.add('someEntity', {type: 'entity'});

// initialize code called once per entity
Test.prototype.initialize = function() {
    this.someScript = this.someEntity.script.someScript;
};

It’s extra boilerplate and doesn’t validate in the Editor though