Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Dragging GameObjects to scene from canvas

Discussion in 'Getting Started' started by akike, Sep 5, 2019.

  1. akike

    akike

    Joined:
    May 13, 2017
    Posts:
    3
    Hey!

    As title says... Canvas acts as inventory. I want to be able to drag gameobjects to the scene from canvas.
    What should I put to the canvas? Images? GameObjects? and how an earth I can drag them from canvas to scene as gameobjects.
     

    Attached Files:

  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,192
    You'll probably want Images in your Canvas, but at some point during the drag, you have to convert those to real GameObjects.

    You could do that as soon as the drag starts, or do it at the end on mouse-up, or do it when the dragged image leaves the canvas bounds. Whatever makes sense to you.
     
    Joe-Censored likes this.