Cant setup reference to object in blueprint based on c++

So, the problem is: I have two c++ classes - my player character and my weapon actor.
In my player character I define variable for my weapon item:

	UPROPERTY(EditDefaultsOnly, Category = WeaponInventory)
	class AWeaponItem* DefaultWeapon;

And I have a blueprint of my weapon, parent from AWeaponItem.

But in my blueprint for my character (parented from my player character c++ class) I cant find any reference for my weapon blueprint. What is wrong??

Thanks for any help :frowning:

You made object pointer which can point spawned object, which blueprint editor can’t associate with anything as blueprint (which is same as C++ class) don’t know what objects will exist when it gonna be spawned. You can only preset those varables in detail tab and when both objects will be placed on level, then spawned object (since oyu place it on level) know for sure there will be object you set.

From whey you talking you want to pick class of object that you gonna spawn, then you need to use UClass* insted or even better:


Which will limit the selection of clasdes in editor to specific class relation. Based from this varable you spawn actor on BeingPlay, as you got C++ Character do that in C++ with


The thing in < will make this function automaticly cast the return value (which will be AWeaponItem* to newly spawned weapon), without it would return AActor*

Now I’m even more confused. I did try to change my property type to TSubclass, but that didnt help me at all.
How than I can choose mesh type for my character blueprint (created from class)? What is so special in UClass? Im so confused… I did take a look at the shooter sample game, but I cant find any critical difference in property declaration, except that they create a array before.
And what about SpawnActor? I mean, the problem is I cant setup my default variable in editor, not in game :frowning:

Try removing class from class AWeaponItem* DefaultWeapon;

I have no idea why, but

TSubclassOf<class AWeaponItem> DefaultWeapon;

worked for me.

Thanks for help, actually that didnt solve my problem, but I found a solution (posted above)