I would like to create an instance of an object when a user drags the object's icon to the scene (strategy game placing units at the game start). I've achieved this so far by specifying the objects. Now i would like to do it in a general way so that the instance name is set in a variable in the icon and when icon is dragged, an object instance is created from this variable. Here is the current code i have working with comments on what i would want to achieve:
dropbox.com/s/99751twuwskfutm/Create%20Instance.JPG
Any ideas on how to do that or suggestions on alternative methods?
Thanks.