So,i’m having a bit of an issue with instantiating my gameobjects into to universe(My Scene object).
I can create an empty object from scratch and populate it from there with ease,my problem starts when i try to clone the gameobject which i just created.
My steps are
- I create an empty gameobject (GAMEOBJECT A)
- I add an component to it (COMPONENT A)
- Now i create a gameobject B from A
- GameObject B created,and the component A is in the component list of the gameobject B
- I try to get the component using inheritance but nullptr returns
It seems when i try to clone components,it returns only the base class pointer.There i try to recreate the derived class and add it to new gameobject’s component list but obviously i fail.
- If i cant solve this with inheritance how can i solve it ?
- is there better way to implement such a desing ?
- or i just fail to use inheritance in c++.If it’s, can you guys point out what am i doing wrong here
This is my GameObject AKA RGameElement
This is my Component AKA RElementComponent
and this my Instantiate via gameobject ref function