- Home /
Design/discussion question
Should a HealthPack script add HP to my Player object or should the Player script add health to itself on collision?
I know the practical result is the same, but from a code organization standpoint is it better to have my HealthPack script add HP to my Player object, or is it better for the Player script to add HP to itself upon collision with a HealthPack?
I'm leaning towards keeping this type of logic in the HealthPack script, because if I start adding more types of collectibles to my game the logic in the Player script will become long and harder to keep organized.
Does anyone with more experience have feedback on best practices?
You need to post this on Unity Formus. Unity Forums is designed for discussion/design questions. Unity Answers deals with single, specific technical questions. As a general design philosophy I keep information as tight as possible. Anything I can keep from sharing, I do. But what that means in this specific case and whether my philosophy has merit is what makes this a design/discussion question.
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to change my stop watch code into real time? 2 Answers
Help with hiding an object on trigger enter 1 Answer
Trouble grabbing and holding a cube. 0 Answers
Triangle Mesh Problem 2 Answers