Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

need help with instantiating a gameobject

Discussion in 'Scripting' started by Robster95, Aug 15, 2020.

  1. Robster95

    Robster95

    Joined:
    Jul 3, 2019
    Posts:
    152
    I am working on a small pong clone and planned on completing it in about an hour and so far i've got it just cant get the ball to respawn. I was able to do this exact process with a different program I was working on last night but cant seem to get it to work here. I have the ball hitting a boundary and destroying the gameobject.

    with a OnTriggerEnter2D I have the boundary destroying the ball and trying to instantiate it calling for the ball prefab however it wont instantiate the ball.

    when I try to have it be created in the middle of the screen I keep getting errors saying cant convert vector3 to transform when I put a vector3 or a transform in the second part of the instantiate arguements.

    Please if anyone knows I would appreciate any help
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,266
    This happens when you try to assign the position to a transform when you really need to sign it to transform.position.