Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by pradeepdmsp · Feb 24, 2017 at 08:34 AM · eventsystemdrag-and-dropevent triggeringlisteners

How to Event tigger when drag and drop complete

instantiate objects drag and drop system is implemented for collectibile card game ..i want when drag and drop is successfull done into relevant places ..some event ,(method) running

player can drag and drop what ever the card (object ) to given places ..order can be vary ,but how ever the each 4 slots fill with one card event should be triggeralt text

unityed.jpg (84.3 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Pengocat · Feb 24, 2017 at 06:45 PM

If you use Unity UI and an Eventsystem you could have a script on each item that implements IDropHandler and IDragHandler. Here is an example that simply drag and drop a colour.

 using UnityEngine;
 using UnityEngine.EventSystems;
 using UnityEngine.UI;
 
 public class MyDrag : MonoBehaviour, IDropHandler, IDragHandler
 {
     Image myImage;
 
     void Awake()
     {
         myImage = GetComponent<Image>();
     }
 
     public void OnDrop(PointerEventData eventData)
     {
         if (eventData.pointerDrag != null)
         {
             myImage.color = eventData.pointerDrag.GetComponent<Image>().color;
         }
     }
 
     public void OnDrag(PointerEventData eventData)
     {
     }
 }
Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image pradeepdmsp · Feb 25, 2017 at 02:31 AM 0
Share

i have place holderslist ..once the child object is loaded ..i have to start the game so how can i check is the place holders are filled with cards? alt text

capture1212.jpg (36.1 kB)
avatar image Pengocat pradeepdmsp · Feb 25, 2017 at 03:48 AM 1
Share

What is place holerslist? Sorry I don't understand any of that.

avatar image pradeepdmsp Pengocat · Feb 25, 2017 at 06:19 AM 0
Share

there is gameobject list each 1,2,3...panels ..i have put it to that list..when player drag and drop give card to that panel..it takes as a ..child object.. now i wants to check whether the above listed game object has child or not?

Show more comments
avatar image pradeepdmsp · Feb 26, 2017 at 01:40 PM 0
Share

@Pengocat i want to implement this kind of a game ..could you please go through the game and get the idea..i'm trying say.. http://www.transformersgames.co/game/transformers_action_pack.html

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

95 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

IDropHandler only trigger when it's SpriteRenderer sortingOder is higher than draggable sortingOder 0 Answers

Count and find NON-PERSISTENT UnityEvent listeners: How? 1 Answer

OnPointerClick only triggers when clicked on the top part of UI Image 1 Answer

Twitch Chat Emotes & Alerts to trigger events C# 0 Answers

transform.postion behaving strangely when dragging an object 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges