Hey there, fellow GAF devs! (well, technically I'm a student
).
We're currently developing a 2D turn-based strategy game (with mechs) in Unity as a student project and are stumbling upon some annoying 'roadblocks' and I figured I could ask if anyone here could help us out a bit.
Here's the situation:
In this game, a unit consists of 3 parts: the mech-class, which has the actual stats and skills, the pilot-class, which also has some specific gameplay relevant data and the actual unit-class, which takes the data from the mech and pilot and handles all of the gameplay code.
We handled this at first by having a mech and pilot prefab each and putting them as children of the unit-object:
Unit
| - Mech
| - Pilot
Problem is that nested prefabs in Unity are god awful and make changing values a pain (learned that the hard way, please correct me if there's something obvious I'm missing <.<).
We then thought: Let's just do it the old fashioned way and give the unit a reference to the mech and pilot prefabs and instantiate them once the scene starts.
So far so good, but this approach also has a couple caveats: individual adjusting of the prefabs directly in the inspector isn't possible this way, you have to make a different prefab for every configuration. This isn't that big of a problem, because individual changes would be a nightmare in larger levels with more enemies and all anyway, so that doesn't matter much.
But we had some nice OnGizmo-code on the mech-class, which visualized attack- and movement-range in the editor and made adjustments to the enemy/unit placement a bit more convenient. That's gone now since we only instantiate the mech-prefab on scene-start :/
Is there a better way to handle this or do we just have to pick our poison?
..I just realized whle typing that wall of text that we could still start the scene, pause and have a look at the gizmos that way. Not optimal, but better than nothing, I guess.
Still, I'd be thankful if anyone had an idea.