Hi Guys,
I have a custom class, UItem, derived from UObject. It contains a lot of information about a given in-game item, including a reference to an actor blueprint, in case we drop it from an inventory/equip it and want to show the appearance, for example.
Here’s a quick look at the header with all of the extra stuff taken out:
UCLASS(Blueprintable)
class UItem : public UObject
{
GENERATED_UCLASS_BODY()
//The blueprint of the actor
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Item")
TSubclassOf<AItemActor> ActorBlueprint;
}
AItemActor is derived from AActor.
In editor, I have created a blueprint derived from UItem - called ShortswordItem. It sets a bunch of variables - including the “ActorBlueprint” variable, which is set to another blueprint, itself derived from AItemActor. Here’s how it looks:
Clearly labelled “SteelShortswordActor”.
I then load this UItem-derived object in C++. This is how it looks while debugging:
This is correct. However, the ActorBlueprint variable is inexplicably also set to the same value, despite the image before showing it set to the actor:
The ActorBlueprint should be the “SteelShortswordActor” blueprint.
Have I made a mistake somewhere? Is this a bug? Is there a better approach for this sort of thing?
Thanks!