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 trigger
Answer by Pengocat
Feb 24 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.
public class MyDrag : MonoBehaviour, IDropHandler, IDragHandler
myImage = GetComponent<Image>();
public void OnDrop(PointerEventData eventData)
if (eventData.pointerDrag != null)
myImage.color = eventData.pointerDrag.GetComponent<Image>().color;
public void OnDrag(PointerEventData eventData)
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?
What is place holerslist? Sorry I don't understand any of that.
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?
@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
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
101 People are following this question.
Disable current drag of UI.Slider
How to only click on certain objects/buttons and null the rest please help!!
Help with Unity Events
onClick Event for UI Text?
Calling a function through EventTrigger does not loop.