1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. Unity 5.6 is now released.
    Dismiss Notice
  3. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  4. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  5. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    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:
    846
    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:
    846
    Cool. I've used that before to flip cards, too :) Glad ya got it solved.