- Home /
Best way to change a character in game?
Hello! I have a 2d action/puzzle game like trine but i am having trouble with the swap thing. The players change: HP, velocity, animations, sprites and 1 active ability.
1- Should i cycle between diferent gameobjects? or 2- Should i change the properties (turn on off components, cycle an array of sprites, etc) of a single gameobject?
Thanks in advance.
Answer by Freesmith · Jul 20, 2019 at 06:47 PM
I would go with the first option . Prefabs for each character type.
That way you dont need to add some extra logic and code for defining each type.
Its easier for changing the number of available characters , removing tests, adding new characters, or creating a variations of existing ones.
Its easier for tweaking colliders on each character.(even if you dont need that right now).
If you need some variations in behavior , that way each character type can have its own animation controller, or you dont have to swap those.
They can have the same type of components , or not, or have some unique to that character type. But adding and removing components is going to be much easier.
The other option sounds doable, but i would not recommend it, even in simple cases.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Initialising List array for use in a custom Editor 1 Answer
DDMS error code.PVRSRVAllocDeviceMem. android game, Crashed. 0 Answers