Search Unity

Problem with instantiated gameobject.

Discussion in 'Getting Started' started by gwnrobin, Aug 31, 2023.

  1. gwnrobin

    gwnrobin

    Joined:
    Jan 4, 2021
    Posts:
    10
    I am getting different behaviour from a prefab that is placed in the world and a prefab that is instantiated. When I put my prefab in the world everthing works fine. but when I Instantiate the prefab it seems like the code is not able to track a transform that is on a other child then where the code is on.
    upload_2023-8-31_21-39-55.png
    this is the prefab that is placed in the world like how it should work. here you see the red and a couple of green pixels from the lines that are in the same place.

    https://gyazo.com/8f3cecead50dd7b968a57bb76260dc0c

    now I Instantiate the same prefab from before.

    in the gif you can see the lines do not allign with eachother and I do not understand why.
    the code and the prefabs are exactly the same.

    I hope someone can help me with this I am really stuck.
     
  2. gwnrobin

    gwnrobin

    Joined:
    Jan 4, 2021
    Posts:
    10
    Found out this thread shouldnt be here. but I dont know how to delete