did a little digging and haven’t figure out the issue… but basically i’m looking at setting up some localization texture swaps using Resources.Load but i have immediately ran into a road block.
Just a simple test as follows…
GameObject go = GameObject.Find("story01BG");
go.renderer.material.mainTexture = Resources.Load("de_notes_1");
nets this error…
Assets/scripts/helpers/LocalizedTextures.cs(15,38): error CS0266: Cannot implicitly convert type UnityEngine.Object' to
UnityEngine.Texture’. An explicit conversion exists (are you missing a cast?)
Not really sure what i’m missing but that is verbatim from the unity docs. Any suggestions?
Thanks in advance!
Provided it’s C#:
GameObject go = GameObject.Find("story01BG");
go.renderer.material.mainTexture = Resources.Load("de_notes_1") as Texture2D;
Resources.Load() casts it up as a base Object, so you have to specify what it is before passing it to mainTexture.
Thanks for the quick reply Ntero. Now to my next, and hopefully final q. 
Texture currentTexture = SourceObjects[0].renderer.material.mainTexture;
SourceObjects[0].renderer.material.mainTexture = Resources.Load("de/" + currentTexture) as Texture2D;
Basically i want to reference the same exact texture that is currently being used (aka currentTexture) and then reapply that using a texture of the same name from the resources folder (in this instance the one located in de/.
The problem i’m having is that i can’t seem to get the captured name from my texture converted to a string. If it replace (“de/” + currentTexture) with (“de/notes_01”) it loads fine. I’ve tried converting the texture name to a string using toString() but it doesn’t seem to want to convert (saying that Texture doesn’t support toString).
Cheers!
currentTexture is a texture, not a string. You might want to test with currentTexture.name instead
@Dremora,
Thanks a ton. I knew was missing something.
Appreciate the help everyone.