ndelchen
(ndelchen)
November 26, 2018, 9:00pm
1
This is what’s called forward declaration . It just tells your compiler that the class exists. Otherwise the compiler doesn’t know the class and will throw errors.
Instead of using forward declarations you could also include the header file of the class. However, this might lead to longer compile times and other problems.
You can read more about it in this link .
Hope that helps!
UCLASS()
class MYTOWERDEFENSE_API ATowers : public ARuleOfTheCharacter
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "BaseAttribute", meta = (AllowPrivateAccess = "true"))
class USphereComponent * AttackRange;
}
ndelchen
(ndelchen)
November 27, 2018, 1:25am
3
Almost. You wrote USceneComponent instead of USphereComponent…
So this one is the same:
class USphereComponent;
Uclass()
class MYTOWERDEFENSE_API ATowers : public ARuleOfTheCharacter
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "BaseAttribute", meta = (AllowPrivateAccess = "true"))
USphereComponent * AttackRange;
}
ndelchen
(ndelchen)
November 27, 2018, 1:32am
4
I’m sure you will improve your skills, just takes some time
Would you be so kind to mark my answer as correct?
Thank you for your reply. Is the function the same as this one?
class USceneComponent;
Uclass()
class MYTOWERDEFENSE_API ATowers : public ARuleOfTheCharacter
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "BaseAttribute", meta = (AllowPrivateAccess = "true"))
USphereComponent * AttackRange;
}
Thank you for your explanation. I’m still too unfamiliar with developing in C++ language.