Cant select custom blueprint class in defaults of another blueprint

It seems any blueprint I have created with my custom C++ classes can not be selected in the defaults of another blueprint. If I put a blueprint reference into the game then select it in the drop down I get this error. “illegal TEXT reference to a private object in external package”.

I am making an inventory system with pick up items and weapons. so when you pick up the item or weapon that class has a variable to point to a weapon blueprint, which then gets added to the inventory. However I can not seem to link any of my custom c++ classes to each other. Is there something I am missing here? The weapon.h and pickup.h files extend AActor and I have include the [PROJECTGAME]_API macro as i thought this might be it, but no go. What am I missing? on version 4.7 right now.

Ideally I do not want to have to put a reference into the game , I want to spawn them at run time using the selected weapon blueprint class. Also looked through the shooterGame c++ code and cant see any differences yet.

okay so I dont know if this is the best way as I would like to just select a blueprint. But instead I added a UClass* WeaponClass and am going to spawn that and assign it to the Weapon variable. Is there any way to select the blueprint itself? using this: AWeapon* Weapon seemed to almost work…

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Any)
TSubclassOf WeaponClass;

If I understand it correctly this should serve your purpose. Spawn your object using this instead of a UClass* and you should be able to alter/use it anywhere, both in code and in blueprint.

Thank you , was indeed what I was looking for.

How did you solve the issue? I have the same problem. Are you using it as a Uclass and casting it back? or are you creating a new object in the scene with the references set to this and use it for initialization?

Hey Ralph, I am spawning the Weapon and using a reference to initialize it.

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Inventory PickUp")
	TSubclassOf<ABaseWeapon> WeaponClass;

class ABaseWeapon* Weapon;

and my .cpp

	if (WeaponClass != NULL)
	{
		Weapon = GetWorld()->SpawnActor<ABaseWeapon>(WeaponClass, owner->GetActorLocation(), owner->GetActorRotation());
		if (Weapon)
		{
			owner->AddWeapon(Weapon);

			if (AutoEquip)
			{
				owner->EquipWeapon(Weapon);
			}
		}
	}