Spawn Object

35796-obrayok.png

Hello im trying to spawn wall, i have start point and end point, i drag mouse this white mini wall and when i stop holding mouse button it should spawn wall object on left. When i make long mini wall i need to spawn more wall prefabs in road. But my code works bad, any advice ?

void VytvorStenu(){
		float distance = Vector3.Distance (start.transform.position, end.transform.position);
		if (!creating) {
			Vector3 pozicia = start.transform.position;
			//float distance = Vector3(start.transform.position, end.transform.position);
			for(float x = 17; x < distance; x+=17){
			plocik = (GameObject)Instantiate (plot, pozicia, Quaternion.identity);
				plocik.transform.LookAt (end.transform.position);
			pozicia = start.transform.position + new Vector3(17f,0,0);
				Destroy (stena);}
			Destroy(stena);
		}
	}

Guys thanks for reply i solved it, i need to get end - start and then normalize and work with normalize vector, thanks all