[SOLVED]Using attributes as access

The name of my script is Interaction.

Can I just type this in:
Interaction.attributes.add(‘texturedbox’, {type: entity}); and the entity that I created that is called texturedbox would just enter the code so i can access it even though it is not the object that the script is attached to?

Can you rephrase please? I’m not sure what you mean here? Do you want to access another Entity’s script attribute data?

I mean if i create an entity in the hierachy, and then use attribute.add for a script that is not attached to the entity i created. Can i access it the entity i created with attribute.add?

If you create script with:

SomeScript.attributes.add(‘texturedbox’, {type: entity}

And attach that script to Entity A in the scene, that will give you an attribute in the Editor that you can reference any Entity in the scene.

For example, you can reference Entity B in the scene on the script instance that has been attached to Entity A.

In the script, this.texturedbox is a reference to the Entity that is referenced via the Editor (in this case Entity B). This means you can access any properties, components, scripts etc that is on Entity B.

Does that help?

yes, thanks