When importing a Photoshop file, it can be helpful to set the material that the Sprite Renderers will use by default (like how a 3D model importer allows assigning materials).
When a different material other than Unity’s default sprite material is needed, it’s impossible to assign a different material directly to the imported prefab. If you need a prefab, you are forced to create a prefab variant with the desired material, manually changing all the Renderers’ material.
Hey @Ted_Wikman
My use case is when using the PSD Importer for a 2D Animation rig. I have a material with a custom shader that I want to assign the generated rig’s prefab. (Currently, I need to manually assign it to each sprite renderer and then create a new prefab variant).
sry for the necro
But I can’t find any mention of this except here, so I’m writing a reply.
Is there currently any support for this?
Or can it be added if it’s not there?
To use a material rather than Sprites-Default,
it feels very cumbersome to manually replace all the material with every layer of an object instantiated through the PSB
for example
MyImage.PSB has 20 layers.
I want to apply Custom Material.
What is the right way to do it?
Is it really right to create a Prefab variant and manually override Material on 20 layers?
Right now we don’t have a good way for you to change the prefab while its being created in the importer. What you can do is create an editor tool which creates a prefab variant from a selected prefab, and overrides the materials in all the SpriteRenderers it finds in the prefab.
You can have a look at the codings examples under [MenuItem] for some inspiration on how to get started.