Hello super playcanvas team!
So I just got into a scenario where I have a flower (model) that seems to have 140+ petals that points to the same material.
Since I want to have a blue version of this flower. I have four choices
- Select one by one my mesh instances I want to customize. (140+)
- Drag/drop 140+ time a new material on each mesh instances
- Create a script, I guess, that will automate this for me (replace material)
- Get a better flower that does not have 140+ petals on it
I have a non efficient case here, but it somehow highlight the fact that some multi selection tools could be nice.
Thanks for the great work guys
Aha, I’ve stumbled on this myself a couple of times. I may have an editor script that can automate it in the meantime. Let me dig it up.
I already created a feature request for this in the past, but it is already closed because there is a work around.
Here is a script that you can run in the editor console, and automatically assign a material to a mesh instance slot on several model assets at the same time.
You can rework it a bit to do something similar for your use case to assign the same material in multiple mesh slots:
Cool! I missed the feature. That part of the problem is solved then, I assume that if a mesh as 2-3 materials, I just use the replace feature on each of them?
So what about the mesh instance customization part?
I’m not sure what you mean with this.
How do you open the console?
So that would be the browser console, on Chrome that is F12 or Ctrl + Shift + I on keyboard.
You can find it in the browser settings side menu:
My understanding is that the replace feature would work replacing the asset materials right? anywhere its used? Which is nice now that I know about it.
What about the entity materials? To customize the entity, I need to select all submesh materials I want to replace one by one. ref: original post image
Ho! that console! didnt realized you could copy paste code in there. Nice and thanks!
Yes, I’m afraid to. Unfortunately my feature request is closed, but they might consider reopening it to tackle that to.
No worry! its just a suggestion.
Thanks for the support! I managed to learn a little bit more about the engine!
When you import the model @memleak, does it create multiple materials too?
Only one in that specific case. But maybe I would like to change a few petals color. Or maybe I could have a complex car model in the futur that have many parts.
I would create post a reply to the closed issue about this use case and hopefully that would get reopened again.