In a prototype of my character, I use a second capsule component to do fancy stuff in my blueprints.
However it is time to start transferring to C++… but I can’t get adding this capsule in code to work!
human.h:
UPROPERTY(VisibleDefaultsOnly)
class UCapsuleComponent* CapsuleComp;
Whenever I run this code, the entire unreal engine crashes. D:
Anyone know what the problem is? I’m guessing a capsule isn’t run with CreateDefaultSubobject, but idk how.
I already had the objectinitializer, but never did the whole PCIP.CreateDefaultSubobject. Thanks.
Alas, it still crashes.
I notice that even when I remove the code from the .cpp file, it still results in a crash.
So could it be possible that this piece of code in the header file is to blame?
UPROPERTY(VisibleDefaultsOnly)
class UCapsuleComponent* CollisionComp;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Your Category, Sub Category")
UCapsuleComponent* CapsuleComp;
Also just to be safe make sure you don`t have a second component with the same name.
But if you are deriving your class from ACharacter:: it should have a capsul component setup out of the box.
I’m needing a second capsule to detect overlaps so I can do edge grabbing…
And yeah, when I posted it I changed the name. So it should work! But… even if I do exactly what you tell me!!!
What could be the problem??? This is really bugging me.
EDIT: HUZZAH! It worked! It seems that adding class in front breaks it! YAY! Thanks so much!!