Currently I'm doing like this
foreach (var obj in DragAndDrop.objectReferences)
{
GameObject go = GameObject.Find(obj.name);
if (go != null)
{
GameObject parent = GameObject.Find("Parent");
if (parent == null)
{
parent = new GameObject();
parent .name = "Parent";
}
go.transform.SetParent(temp.transform);
}
}
However, I try to drag something with the same name and it will be instantiated by other name(like A(1) rather than A), I can't find it with its name.
Also I try to create an instance by my own and put it to my parent node by code when I drag something into scene view. However, it seems unity will create an instance by itself so I will have two copies of instance in the scene view.
So how can I get the instantiated objects and put them to my parent node?