Attach same script multiple times to a single entity

I know this question was asked on 2017, but wasn’t resolved and maybe there is an update.

Sure I could just copy the script and make it whatever-I-want2.js , but hopefully there is a better solution.


Hi @dadiaar,

Yes, that’s not supported by the engine right now, it’s like that by design.

What’s your exact use case for something like that?

I have worked with other engines that support this concept, but usually it’s not something you can’t work around in some way.

1 Like

Hi Leonidas, thanks for the fast reply.

In this case, the script changes some textures of a chosen material. If the entity had multiple materials, I would have added the script multiple times.

It’s fine, I’ll design accordingly.

Have a nice day.

1 Like

For this specifically, you can use an attributes array or JSON attributes array if there’s specific properties needed per material? Script Attributes | Learn PlayCanvas

Unfortunately, I don’t think we ever allow for multiple scripts of the same type to be added to the same entity given the current architecture

1 Like