Hey guys,
I have a developer settings class that I made, which contains a UDataAsset which holds an array of actors.
Each time I relaunch the editor, those references are null.
The only solution is to delete the array and re assigned every time.
Can someone explain what’s going on here?
The data asset:
class USpawnerDataInfo : public UDataAsset
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere)
TArray<TSoftClassPtr<AActor>> ActorsList;
};
The developer settings:
UCLASS(Config = Game, defaultconfig, meta = (DisplayName = "Spawner Settings"))
class USpawnerSettings : public UDeveloperSettings
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Config)
TSoftObjectPtr<USpawnerDataInfo> DataInfo;
};
Isn’t that exactly the expected behavior of a soft object ptr?
If it’s the object ptr that’s null (rather than the class ptr) then you need to actually load it to make it non-null.
I know it’s the point of a soft pointer.
But that’s confusing me becuase there’s some TSoftClassPtr that shows a valid memory address on debug, and some that aren’t.
Which I didn’t load them. Any at all.
Maybe that’s the request behavior but I can’t understand why.
Yep, it was initiated else where that why it showed be it has an address.
And reason I thought it was null (or any problem) that’s because I tried printing the name of the soft class using GetName which cause a null exception.