I took this right from Unity’s scripting reference. It tell me…
Cannot implicitly convert type UnityEngine.Object' to
UnityEngine.Texture’. An explicit conversion exists (are you missing a cast?)
void Start ()
{
renderer.material.mainTexture = Resources.Load("F-USA", typeof(Texture));
}
Resources.Load returns an object, the error even tells you than an explicit conversion exists and that you may be missing a cast.
renderer.material.mainTexture = (Texture)Resources.Load("F-USA", typeof(Texture));
Thanks, it compiles now, but still does not display the texture. It will display the texture if I declare it public and drag the texture onto the variable in the editor and do not use Resources.load. But I have 35 of these, which I can do 35 times np, but rather do it in 1 line of code.
Is it returning the texture?
Is your texture in a Resources folder? (it cannot be Assets/Resources/Textures/F-USA)
Thanks for the quick replies. That fixed it.