Unity 2D - Creating a Character GameObject that can switch weapons
This is for a 2D game.
I am creating a character that will be able to switch both armors and weapons. For it I have 2 separated spritesheets, one for the different kind of armors, and one for the different kind of weapons, so I can make all the combinations I want.
Unfortunately, seems like I can not add 2 Animator Components to the same GameObject. Therefore I have created the following GameObject structure.
Character
+--> Armor
+--> Weapon
+--> Hurtbox
+--> Hitbox
The downside is that this complicates the communication between the different sub-gameObjects of the character.
I was wondering if anyone think this is a good solution or there are better ways to handle this.
Thanks.
Answer by Bieere · Oct 08, 2015 at 06:09 PM
So have the character as the parent Object, and just have everything else as children, you should be able to change the sprite sorting orders accordingly, though you will need renderers/animators for each object accordingly.
But you're on the right track in my opinion!
Your answer
Follow this Question
Related Questions
Destroying and Creating a GameObject 1 Answer
Cannot properly access player position 1 Answer
C# - using getcompenent 1 Answer
How to get the position of a gameObject based on its index in an array? 0 Answers
If you want to destroy the game object, please call 'Destroy' on the game object instead. 1 Answer