Download

How can I get a static mesh in a UActorComponent subclass?

Usually, I would put:


UPROPERTY() UStaticMeshComponent* StaticMeshComponent;

Inside my Actor. Now I would like to put a static mesh in an ActorComponent. How do I achieve this?

Currently Unreal doesn’t handle components inside components very well. You could add the static mesh component on the owner of your UActorComponent subclass, and inside that component subclass store a weak ptr reference to it and look it up on the owner at beginplay time.

Ok, I will try.