Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: westingtyler on August 29, 2018, 07:19:25 AM

Title: Material Compare Always False Because of (Instance) in Material Name?
Post by: westingtyler on August 29, 2018, 07:19:25 AM
I create a prefab and set its material to Material A. Then on the next operation (another right-click) it checks if the material is Material A. If so, it's supposed to Cycle to Material B, C, etc. But it always returns false. Here is a picture of it.

Notice how the game object's material is Material A (Instance), and the one compared for is Material A. What's the deal with this? Does this mean every time I'm creating prefabs it's adding more draw calls by duplicating materials? How do I fix this?

PS. It would be handy to have a Material Switch action, to avoid having a state with multiple Material Compare actions.
Title: Re: Material Compare Always False Because of (Instance) in Material Name?
Post by: djaydino on August 29, 2018, 12:19:46 PM
Hi.
Maybe you can use 'Get Material Name' and compare that?
Or use a string switch.
Title: Re: Material Compare Always False Because of (Instance) in Material Name?
Post by: westingtyler on September 02, 2018, 11:03:53 AM
If it's creating material instances, doesn't that add draw calls? This would suck if the player needs to create dozens of the same object. Isn't there a way to cause it to use the same material rather than creating an instance?

I traced this to the Set Material action. It never uses the same material, but an instance, which also makes it difficult to later edit the core material since it seems to no longer reference the original material? is that right? Even if the material has GPU instancing disabled, it still creates this instance.