I created "main script" and in Start()
created simple cube:
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.localScale = new Vector3 (1,2,1);
cube.GetComponent<Renderer>().material.color = new Color(0,0,255);
cube.AddComponent<CubeScript>();
and then in CubeScript I have empty Start()
and Update()
but in onMouseDown()
just Debug.Log("click detected");
and I can never see log despite clicking on cube.. Any advice? did I missed something?
Addcomponent
it should beAddComponent
\$\endgroup\$