I’m doing some university study in software eng and I feel like I should be able to figure this out but still can’t get my head around it properly.
In the Unreal docs there is this defintion of TSubclassOf:
TSubclassOf is a template class that provides UClass type safety. For instance, let’s imagine that you are creating a projectile class that allows the designer to specify the damage type. You could just create a UPROPERTY of type UClass and hope the designer always assigns a class derived from UDamageType or you could use the TSubclassOf template to enforce the choice.
The way I have used this class is as follows:
- create a c++ character. the c++ character is the parent to a character blueprint
- in the c++ character class I can create a UProperty like:
UPROPERTY(Category=“Bullet”, EditAnywhere, BlueprintReadOnly)
So what that seems to do is create a variable called BulletBP in the character blueprint and there is a drop down list.
I have a bullet c++ class representing different bullet types and this is the parent of a bullet1_bp and bullet2_bp. In the BulletBP drop down list in the character blueprint I can select which bullet to use.
Lets say I select bullet1_bp in the BulletBP dropdown list. What I can’t seem to get my head around is why I can’t get a reference to the contents and variables of the bullet1_bp (whose parent is the ABullet class) from within the c++ character class.