You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@pepcots
In the Awake of Root.cpp we are creating the baker house. I took your advice from class and changed the Components work as variants than can hold either Transform or MeshRenderer components for now. The thing is i thought storing these variant components in a std::map would prevent them from being deleted but if i put breakPoints in the destructors of Component, Transform and MeshRenderer they are getting called like crazy. When i exit the scope of Root.cpp all components are presumbaly destroyed but later the transform seems to exist but not the Meshrenderer.
!!! im doing this in the "attempt-Components-with-variants" branch
The text was updated successfully, but these errors were encountered:
@Marco-v-BaldanII
When using a map, or any other container, you should always try to use the "emplace" approach: https://en.cppreference.com/w/cpp/container/map/emplace
In your code, you are inserting items to the map by using random access: map[key]=newItem
But this is making a default item in the [key] position, and then, copying newItem to there, so, what you see are the destructors of the rvalues (newItem).
@pepcots
In the Awake of Root.cpp we are creating the baker house. I took your advice from class and changed the Components work as variants than can hold either Transform or MeshRenderer components for now. The thing is i thought storing these variant components in a std::map would prevent them from being deleted but if i put breakPoints in the destructors of Component, Transform and MeshRenderer they are getting called like crazy. When i exit the scope of Root.cpp all components are presumbaly destroyed but later the transform seems to exist but not the Meshrenderer.
!!! im doing this in the "attempt-Components-with-variants" branch
The text was updated successfully, but these errors were encountered: