Hi everyone!
I want to create materials at runtime.
In Unity we have no other choice but to use the Material constructor passing Shader into it.
new Material(_shader);
But when I look at profiler I see a strange call at the Material constructor:
As you can see on the screenshot “MaterialEditor.ApplyMaterialPropertyDrawers” allocates 0.6KB per material creation.
I need to create materials quite often so I really want to remove this allocation.
I don’t understand why Material constructor calls Editor methods, that’s strange.
Moreover, I never look at material’s inspector, cuz these materials are hidden.
I also tried new Material(templateMaterial);
which gives the same result.
I didn’t test this in the build just yet. Anyway, this is strange and not expected behavior.