Loving PlayCanvas so far! Very powerful and intuitive engine.
I do have a request/idea, however. It would be great if scripts could be added multiple times to an entity and were completely new object instances every time. That would allow for super flexible scripts.
For example, let's say I create a
SwapMaterial script. This script accepts 2 script attributes: Model and Material. When I place this script on a UI sprite, the UI sprite will now listen for clicks. When it's clicked, it will update the specified model with the specified material. Pretty simple! And works great.
Buuut...what if there are multiple models that I want updated when this sprite is clicked? Ideally, I could add the script a second time, specify the Model and Material in the second instance's script attributes, and viola--another SwapMaterial instance is active.
But since the UI currently only allows a script to be attached once, this isn't possible.
It seems like pretty basic object instancing, so I feel like it wouldn't be that difficult to add to the editor--but then I also don't know the inner workings of how the engine is set up. If this was possible, it would greatly increase the ability for people to create libraries of re-usable scripts within PlayCanvas.
Any thoughts, ideas? Is this something that could be added in the future?