Search Unity

Need small help in Unity - Dragged object getting masked due to UI mask.

Discussion in 'Scripting' started by karjiv, May 24, 2019.

  1. karjiv

    karjiv

    Joined:
    Dec 29, 2018
    Posts:
    25
    Hey,

    I need a little help in Unity.
    I have inventory done but when I drag object because of UI mask object is also getting masked and it is not appearing out of inventory.
    Please check the screenshot.
    Perhaps, it could be a small thing but I don't know much about coding.
    I want my object to appear out of inventory also.
    I have also attached script.
    Any help would be appreciated.
    Thanks...
     

    Attached Files:

    • 001.png
      001.png
      File size:
      143.5 KB
      Views:
      102
  2. Ether141

    Ether141

    Joined:
    Jul 30, 2018
    Posts:
    8
    On begin drag, throw icon out from mask to other game object and on end drag, throw it back to mask.

     
    karjiv likes this.
  3. karjiv

    karjiv

    Joined:
    Dec 29, 2018
    Posts:
    25
    So, if I have 20 slots, does that mean I have to make 20 icon holders with icon?
     
  4. Ether141

    Ether141

    Joined:
    Jul 30, 2018
    Posts:
    8
    No, you don't have to. One holder is enough. You can't drag many icons in the same time. On begin drag, set dragged icon's parent to IconHolder, and on end drag, set his parent back to slot. I hope you know what I mean.
     
    karjiv likes this.
  5. karjiv

    karjiv

    Joined:
    Dec 29, 2018
    Posts:
    25