In my game I have a character prefab that is just a game object with a character script attached to it. At runtime I’ll know what model I’m supposed to use to represent the character and need to dynamically load the model, the collider information and materials. I came up with a solution that works but I’m wondering if there’s a better way to do it.
Here’s what I did.
I created a prefab for every type of character I can have and I put each prefab into the aforementioned character script using the inspector to attach each one. I then determine which of these prefabs I need to use at runtime, instantiate it and set my game object as the parent.
I guess if I wanted to do anything more I’d like to not have the prefab tied to the character script. If there’s a better way to do it I’d love any input as well.
Thanks