Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    9,859
    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.