moving instantiated objects

Hi there!

I am new in unity and i want to make a simple puzzle game

what i want to do is make the objects appear at given locations (and move them from there later on),but they appear in the middle of the scene (X=0,Y=0,Z=0)even though i try to set their starting positions based on i and j (in the instantiate function and after it too) and i can’t move them by scripts either i tried to assign position to x,y,z separately as well with no succes I tried to attach scripts to the prefab to move them on awake as well but that failed too, C# version didn’t help either, google didn’t help either

any help would be appreciated

the code:

	public var shape1 :Transform;
	public var shape2 :Transform;
	public var shape3 :Transform;
	public var shape4 :Transform;
	private var newPos:Vector3;
	
function Awake () {
	// Use this for initialization
				for (var i = 1; i < 5; i++) {
				for (var j = 1; j < 2; j++) {
					var shape=Random.Range(0,3);
					switch(shape)
					{
					case 0:
						var test = Instantiate(shape1,(Vector3 (-10+j*4+2,0,-10+i*4+2)),Quaternion.identity);
						newPos = new Vector3(-10+j*4+2,0,-10+i*4+2);
						test = Instantiate(shape3,(Vector3 (-10+j*4+3,0,-10+i*4+1)),Quaternion.identity);
						test.transform.position = (Vector3 (-10+j*4+3,0,-10+i*4+1));
						newPos = new Vector3(-10+j*4+3,0,-10+i*4+1);
						test.transform.position = newPos;
						break;
					case 1:
						test = Instantiate(shape2,(Vector3(-10+j*4+2,0,-10+i*4+2)),Quaternion.identity);
						newPos = new Vector3(-10+j*4+2,0,-10+i*4+2);
						test.transform.position = newPos;
						test = Instantiate(shape2,(Vector3(-10+j*4+4,0,-10+i*4+2)),Quaternion.identity);
						newPos = new Vector3(-10+j*4+4,0,-10+i*4+2);
						test.transform.position = newPos;
						break;
					case 2:
						test = Instantiate(shape4,(Vector3(-10+j*4+2,0,-10+i*4+2)),Quaternion.identity);
						newPos = new Vector3(-10+j*4+2,0,-10+i*4+2);
						test.transform.position = newPos;
						test = Instantiate(shape4,(Vector3(-10+j*4+2,0,-10+i*4+2)),Quaternion.Euler(0, 180, 0));
						newPos = new Vector3(-10+j*4+2,0,-10+i*4+2);
						test.transform.position = newPos;
						break;
					
				}	
			}		
		}
	}

the problem is that every object remains in the middle of the scene, and won’t move.

sorry for bad english and/or bad explaining

thanks in advance!

On each prefab you should have a script attached. This script should increment the object position in the update method.

Example

public class ObjectMover : Monobehaviour
{
public float speed =10f;

void Update()
{
    //Move the object along its forward direction
    transform.position += transform.forward * time.Deltatime * speed;
}

}