1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  6. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

Weird behaviour with draggable UI Image

Discussion in '2D' started by DaG_II, Apr 18, 2017.

  1. DaG_II

    DaG_II

    Joined:
    Apr 28, 2014
    Posts:
    9
    I'm making a classic card game by Unity. I created a first deck and when I click on the top card it is discarded and it moves to another second card stack. When the first card stack is empty then it is refilled when it is clicked. Furthermore I should to be allowed to drag and drop the cards in the second deck. My problem is that I can't drag and drop a card from second deck until the first deck was refilled a first time and I don't understand why. This a simple example project with a one card stack: https://mega.nz/#!r0IWWYwa!NDgO11BO8UzeZuSsVP2v6OBKlU25RLOf6pk1nFf2tJ0

    I hope somebody could help me, because I really don't understand this very weird behaviour.
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    2,617
    Please post your (relevant) code here, using proper code tags and I'm sure people will be happy to help you out :)
    (I'd be back to read it, for example:))
     
    DaG_II likes this.
  3. DaG_II

    DaG_II

    Joined:
    Apr 28, 2014
    Posts:
    9
    I solved the problem. I flip a card by a rotation quaternion, so the normal of the card will be in opposite position of the casted ray when I click. Since this a 2D project, I decided to simulate the card rotation by scale vector (by uniform scale on x component).
     
  4. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    2,617
    Cool. I've used that before to flip cards, too :) Glad ya got it solved.