I have imported an fbx object from 3D Max and called it shelf1.
I have 2 pngs in the asset folder renamed to mat1 mat2.
In the IDE I can mat1 onto shelf1 or mat2 and the material shows on the object.
I am using the following script (from the forums) but the shelf goes grey on the space key press( shelf1 rotates and I see ‘space key was pressed’ in the console.
var shelf1;
function Start () {
shelf1 = GameObject.Find(“shelf1”);
}
function Update () {
if (Input.GetKeyDown (KeyCode.Space)){
Debug.Log (“space key was pressed”);
shelf1.renderer.material.mainTexture = Resources.Load(“Assets/mat1”);
shelf1.transform.Rotate(0, 100 * Time.deltaTime, 0);
}
}
What am I doing wrong here please ?
Cheers
SteveW