Newbie going nuts again … over CODE
I have a simple cube with a script attached … the script should look to see if a texture is attached to the cube… & there is. I can see it (not just a colour)
I keep getting the following error;
NullReferenceException
UnityEngine.Material.get_mainTexture () (at C:/BuildAgent/work/300357e52574df36/Runtime/ExportGenerated/Editor/Graphics.cs:1126)
Interactor.Start () (at Assets/_Bear Prefabs/Bear Scripts/Interactor.js:17)
here is my script
private var originalMaterial : Material;
private var aoTexture : Texture;
function Start(){
// search scene for an object named MainCamera
cam = GameObject.Find("Main Camera");
if (originalMaterial.mainTexture){ //if texture exists..
aoTexture = originalMaterial.mainTexture; // asigns the materials texture.
print (name + ": " + aoTexture.name);
}
}