So I have ~420ish lines of code in a single C# script and have had no issues with 50+ fairly complicated c# scripts that are all interconnected. Suddenly a (relatively) simple “set texture” has brought my project to a standstill! I’ve tried multiple permutations of basic setTextures coding including the enableKeyword methods and have hit the wall, any ideas folks? <3 for any solutions and code below:
m_Renderer = transmission_Viewscreen.GetComponent<Renderer>();
m_Renderer.materials[0].SetTexture("_MainTex", myTexture);
My transmission_Viewscreen GO has been very co-operative until now but suddenly refuses to allow even a simple texture change, i’d love to hear i’m missing something simple!,I’m at a total loss, I have several thousand lines of code and am totally stumped on this small segment:
m_Renderer = transmission_Viewscreen.GetComponent<Renderer>();
m_Renderer.materials[0].SetTexture("_MainTex", myTexture);
I’ve tried multiple permutations of every answer I can find online but ultimately my “transmission_viewscreen” GO which has a very simple blue 1 pixel texture (assigned to myTexture here) attached comes up with the pre-existing black texture all my newly instantiated GO’s have by default. I’ve tried variations of EnableKeyword and multiple graphics type and still i’m glaring at a black rectangle, any ideas folks? Full code for this particular script is 400+ lines long but happy to upload if it will help!