I have a camera prefab that is spawned into the scene at a specific location. The problem is when it is spawned in the camera is on, on the CCTV object Camera.
Is there a way to both disable and find a camera that has been spawned into a scene.
I have a camera prefab that is spawned into the scene at a specific location. The problem is when it is spawned in the camera is on, on the CCTV object Camera.
Is there a way to both disable and find a camera that has been spawned into a scene.
You could try changing it’s transform to be the child of an empty game object, and then get the children of that game object - though I’m not sure if you can find children that aren’t active.
OK this took bit to figure out. But for anyone who might want to know this in the future.
Unity 5.2 how to find a camera Instantiated into the scene or in the scene in general.
public GameObject CCTV_01_Clone;
public GameObject CCTV_01_Prefab;
public Camera CCTV_Camera;
CCTV_01_Clone = Instantiate(CCTV_01_Prefab, curTarget.transform.position, curTarget.transform.rotation) as GameObject;
CCTV_Camera = GameObject.FindWithTag(“CCTV_1”).GetComponent < Camera > ();