Hi Unity-ers. I’m trying to set up basic character handling in a game, and my mind keeps going in circles about how to best set this up for the future. Hoping people with more experience than I have some advice you wouldn’t mind sharing!
I basically have three pieces (leaving out much of the detail):
- Prefabs for five character objects; the player will select one when the game starts
- A character script to handle basic character functionality
- Eventually, a GameObject instantiation of the prefab representing the character the player selected
Through the course of the game, obviously I’ll need to have access to all three. I am having trouble deciding how to best connect those pieces in a way that isn’t going to make me want to redo it six months from now. The latest I’ve been tooling around with looks something like this:
- I have a persistent/singleton asset manager script that holds references to each of the prefabs
- The character class is attached to each of the prefabs
- A script in each scene would hold a reference to the GameObjects when instantiated
Is that a reasonable pattern? Is there a better practice here I should consider?
Thank you for the help!