Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do I equipt items in unity?

I wanna know how do I add items that already exist in the heirachy into a parent object like say and inventory slot?


Please I need help

Best Answer

  • joachim747joachim747 Member
    Accepted Answer

    Well, as I have done it in the past, you have some code like this:

    var Enemy = Instantiate(...);

    You basically instantiate something and temporarily save it in a variable so that you can access this newly created object to assign it as a child e.g. like this:

    Enemy.transform.parent = someGameObject.transform;

    That should do the trick. There are also other possibilities, as per my knowledge you can also provide the parent object within the instantiate method itself directly, which is likely more cleaner. You should go ahead and check the documentation on that :)

Answers

Sign In or Register to comment.