I have a cube that derives from Actor and this cube has 6 walls. Now every wall is a StaticMeshComponent but I need to make it a class (or struct) instead so that I can later replace one of those walls with another class (like a class that has a double-door or something). But from what class do I derive?
-
USceneComponent: Does not work: https://answers.unrealengine.com/questions/743194/howto-add-staticmesh-to-scenecomponent.html Either an undocumented feature from UE4 or an UE4-bug. But this would have been the logical choice.
-
AActor: I don’t think that it would be a good idea to make every wall an actor (so 7 actors per cube) for performance reasons and such.
-
UActorComponent: Has no position in the world.
-
UObject: This could in theory work but, I believe that it doesn’t automatically replicate and I can’t store any UStaticMeshComponents in it. It bugs UE4 out. Apparently when you have a UStaticMeshComponent placed in say Actor X and then store a reference to that component in another actor or UObject, UE4 will randomly crash and/or not render it. I think UE4 get’s confused between the pointer and the real object because they are the same in c++ code.
I tried everything I know, nothing seems to work.