GetComponent<Renderer>().material.mainTexture = Resources.Load("textures/1") as Texture; 

enter image description here

  • maybe this is the object on which it is applied, turned upside down, and not a texture? - Valera Kvip
  • This is the standard location of the object on the axes - codename0082016

1 answer 1

Do i do the best way?

I rotate inside the GameObject child GameObject2 with the rotated coordinate Rotation z 180

Taken from here http://www.gamedev.ru/code/forum/?id=163254

  1. Simplest. We create an empty GameObject, a subsidiary to it is a "shell" (Simply drag the "shell" onto the created empty GameObject). Then we turn the child "projectile" as necessary.
  • Is this the answer or the continuation of the question? - Valera Kvip
  • This is a bad decision. Now I can not access the nested object. GetComponent<Renderer>().material.mainTexture - codename0082016
  • Finish GetComponentInChildren<Renderer>().material.mainTexture - codename0082016