Search Unity

Move a new created GameObject (Instantiate)

Discussion in 'Scripting' started by Eruheran4, Jan 9, 2013.

  1. Eruheran4

    Eruheran4

    Joined:
    Jan 6, 2013
    Posts:
    19
    Hey guys!

    I want to move a new created GameObject (Instantiate). I creat them at beginning of the game on the position
    Code (csharp):
    1. Instantiate(GameObject, Vector3(0, (i * 0.005), -4), Quaternion.identity);
    and want to move them to
    Code (csharp):
    1. Vector3(-4, i * 0.05, 0)
    .
    I tried it like this:
    Code (csharp):
    1. GameObject.transform.Translate(-4, (i * 0.005), -4);
    But this just will not work. How do I can realise that? I work with Javascript. Thanks in advance.
     
    Last edited: Jan 9, 2013
  2. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    Code (csharp):
    1. var tr:Transform = Instantiate(GameObject, Vector3(0, (i * 0.005), -4), Quaternion.identity);
    2. tr.position = Vector3(...
    something like that, may contain typos
     
  3. Eruheran4

    Eruheran4

    Joined:
    Jan 6, 2013
    Posts:
    19
    .
    Edit: I saw my fault. Thanks!
     
    Last edited: Jan 9, 2013