Hi everybody. What I’m trying to do is to dynamically create an empty object, add mesh filter, mesh renderer and a material. And so far everything works on PC. Even when I assign material like this:
But when I run it on my phone, the object is invisible.
Strangely, if I manually add an object to the scene with “Unlit/Color” shader in the editor, it works on mobile AND dynamic object starts working too. This makes me think that I need to somehow preload that shader before I use it dynamically, right?
UPD. I’ve tried creating a material and assigning it instead of creating it in code. And it works. But I’m just curious if I can make it work with just one C# file. Why the shader doesn’t work on mobile if it’s created dynamically.