Little problem

if (transform.position.y <= -5)
		{
			Instantiate(DeathExplosion, new Vector3 (transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
			camobj = (GameObject) Instantiate(DeathCamera, new Vector3 (10, 10, 10), Quaternion.LookRotation(new Vector3 (transform.position.x, transform.position.y, transform.position.z)));
			[COLOR="red"]camobj.LookAt(gameObject);[/COLOR]
			Dead = true;
			Destroy(gameObject);
		}

explanation: Unit falls from the ground, when it’s y reaches -5 it should die, then new camera is instantiated that is supposed to look at point where that unit died, that is working except I don’t know how to write a function so “camobj” will be forced to LookAt unit

I’ve tried

camobj.LookAt(gameObject);

and it isn’t working, can you just tell me how to write this line

camobj.transform.LookAt([the unit as transform]);

ok ty

also, when your doing this, you should not need to use multiple cameras, you should adjust the main camera to that position. Unless this camera servers a purpose for some other reason (i.e. in a sub view)

my main camera is part of “player” prefab, when I kill it, camera dies also, so I make new camera and point it, and when player is respawned, then I delete old camera and so on :slight_smile: it is only 1 camera in a scene at a time

Destroying the player prefab is always a silly idea when you could just disable the renderer on it and reposition it.