Difficulty Instancing via UnityScript

Hi guys! Bear with me because I am coming to grips with unity and scripting.

I am trying to write a simple script where a plane I’ve created is going to duplicate if it reaches a certain coordinate on the z-axis. However, for some reason if I make the coordinate any lower than -12, the plane doesn’t end up duplicating. Any idea why this might be?

function Update() {
	var speed = .1;
		// Move the plane backward along the z-axis
		transform.Translate(Vector3.back * speed);

//duplicate the plane if it reaches 0, 0, -12
if (transform.position == Vector3(0, 0, -12)){

Instantiate(gameObject, Vector3.zero, transform.rotation);



You have a couple of issues here. The easiest solution would be to:

if (transformation.position.z <= -12.0) {

Note using ‘<=’ in the comparison is very important.

Got it! I thought there must be a less obtuse way. Thank you very much!