Hi,
I am new for Unity.
I have created a game it contains only one scene. I have created a Prefab, it contains a Cube. Dynamically I am creating reference for Prefab with dynamic position and adding it to a scene.
My question is; dynamically how to detect the referenced Prefab (GameObject) and its position?
Thanks in advance.
<h2>Code:</h2>
public class ClassName: MonoBehaviour{
public GameObject myCube;
void Update(){
GameObject cube = myCube;
Instantiate(cube, new Vector3(Random.Range(-10,10), Random.Range(-10,10), z), Quaternion.identity);
}
}