Hello, I’m an experienced programmer but new to Unity and C# trying to get some experience. I’ve been writing some code that could in some day be an RTS and I recently finished adding unit hierarchy ie. a group of soldiers:
- Company
- Company HQ Platoon
-Platoon
- Soldier
- Soldier
...
-Platoon
-Mortar Platoon
where each can be a single Mesh/GameObject ( a sniper ) a group of units ( platoon ) and they would know how to access their children, parent, siblings etc.
I did this using a custom Composite Design pattern when I realized that the “relatives” in GetComponentIn[Children|Parent] only refer to components on the local(right word?) GameObject and that the hierarchy in the Hierarchy Editor window doesn’t seem to persist to runtime.
Is this accurate? Am I missing something easy? Profiling my composite setup seems totally fast enough, if there is a built in Unity way to do this would it be faster than mine?
Thanks for any advice!