Common issues causing Actor Components to not work correctly.
Using EditAnywhere or BlueprintReadWrite on components
Components should not use EditAnywhere
or BlueprintReadWrite
. Instead, use VisibleAnywhere
and BlueprintReadOnly
.
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
UWhateverComponent* WhateverComponent;
Not initializing components in constructor
You need to use CreateDefaultSubobject
in your actor constructor, or correctly initialize components at runtime
WhateverComponent = CreateDefaultSubobject<UWhateverComponent>("WhateverComponent");
Using spaces in component names
Do not use spaces in component creation. This has been known to cause random issues.
//WRONG!
WhateverComponent = CreateDefaultSubobject<UWhateverComponent>("Dont put spaces here");