I’m really struggling with this issue. I need to enable/disable collision and manipulate collision channels at runtime. Just to make my test simple for now I just enable/disable collision without manipulating channels, so the code is just two lines.
My constructor creates the Default Sub Object and assign it
mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(“Mesh”));
RootComponent = mesh;
If I place this code in the constructor of my C++ item class it has effect, my character can walk through the object, and there is no collision.
If I place the same code in another function, after I called SpawnActor() to create my item, then the code has no effect.
UStaticMeshComponent* MyMeshComponent = ((UStaticMeshComponent*)obj->GetDefaultSubobjectByName(“Mesh”));
This is done server side and item is replicated.
Any idea how to set collision after SpawnActor?