Currently I store a string name along with each component inside a map in my GameObject. This is how I identify each component when I call GetComponent<ComponentType>(componentName).
I think I'm going to go the route of only allowing 1 component type per GameObject (make it so you can't add 2 of the same components). To me that sort of makes having to pass a name in the GetComponent function because I'm already defining the type via the template param. So I'm wondering how can I structure my C++ code to make my get call more like:
GetComponent<ComponentType>()
If this is how I want t get my components, how would the storage of these components look in GameObject? The type itself is basically identifying it. Would I still need to ID this type another way? Possibly have each component have a static function that returns a unique ID for that component and inside GetComponent I use Type::GetID() and I still store them in a map where the key is the ID? Or is there another way? I can't think of another way, but curious if I'm missing some ideas around this.
Thanks