I’m doing a Hearthstone style game. Is there any way to get the gameobject’s name from another parent where my card is positioned at the end of the drag?
It is probably possible to do what you want but I do not quite understand what you want to achieve / mean. Another parent? Parent of what? Do you want to know what game object your card is positioned over? Do you have any code / sketches / images to clarify what you want help with? Generally you can use OnTriggerEnter to see what your object collides with (Unity - Scripting API: Collider.OnTriggerEnter(Collider)) and from the collider get the game object your colliding with and its parents / children whatever it is you need. But perhaps with some more details it becomes easier to help you do what you want.
I have 2 cards, each one inside a diferent parent. I want to drag A card to the B, which is in a different parent, and show on the debug the name of the B card.
Sorry if I expressed bad the first time.
Please provide some code or something we can work with
If you have collision box and trigger on the parents of the cards you could do something like this if you have this code on parent/ card A and want to drag it onto parent of card B (and you have named it cardBParent) and find it’s name
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.name=“cardBParent”)
{
foreach (Transform currChild in other.gameObject.transform)
{
Debug.Log ("Child found. Name: " + currChild.name);
}
}