Download

Level asset reference issue

Im adding custom data assets to my project to store campaign and mission data.
Each mission has a level (map) linked to it.



UCLASS()
class SWATRELOADED_API USwatMission : public UDataAsset
{
public:
	GENERATED_UCLASS_BODY()
	
public:
	UPROPERTY(EditAnywhere, Category = Mission)
	FString MissionName;

	UPROPERTY(EditAnywhere, Category = Mission)
	UWorld* Level;

};


When i try to save the asset i get the following error.
The external object is the map and is stored in /Content/SwatAssets/Maps/TrainingFacility



Can't save ../../../../../../Private/GameDev/Games/SwatReloaded/Content/SwatAssets/Campaigns/Mission_TrainingFacitlity.uasset: Graph is linked to object(s) in external map.
External Object(s):
TrainingFacility
  
Try to find the chain of references to that object (may take some time)?


I don’t know much about how maps are loaded, but storing a hard reference to a world like that isn’t likely to work. That would require the map be loaded into memory whenever the asset is loaded.
Try storing it as a TAssetPtr< UWorld > or FStringAssetReference. Also I’d guess (but again I’m not sure) that you should be referencing a ULevel rather than a UWorld.

Tnx,

The TAssetPtr<UWorld> works perfect :slight_smile:
Also changed my Campaign asset to use TAssetPtr for the Mission asset list as well.