There is a script attached to a sphere prefab, in it there is a OnMouseDown event
void OnMouseDown()
{
Camera.mainCamera.backgroundColor = this.gameObject.renderer.material.color;
AudioSource.PlayClipAtPoint(audioClip, transform.position);
CreateSmallerBalls();
Destroy (this.gameObject);
}
so, by clicking on the ball the backgorund change to the ball’s color (which is randomly picked on the awake event).
Now, i want to create smaller balls by clicking the, lets say 4 of them in the position of the clicked ball, the method craeting the balls look like that:
void CreateSmallerBalls()
{
GameObject go = Instantiate(this.gameObject, this.gameObject.transform.position, Quaternion.identity) as GameObject;
if (go != null)
Debug.Log ("Been Created");
}
its seems like i cant create the same prefab using the code above, can anyone help please?