Tutorial
This page shows a quick demo of how to use DcJsonAsset
.
-
First ensure that the plugin is properly integrated in your project. Open
Settings -> Plugins
and search for DataConfig JSON Asset: -
We have bundled a simple Blueprint class
/DcJsonAsset/DcFixture/DcTestBPDataAsset.DcTestBPDataAsset
:It's almost equivalent to a C++ UCLASS like this:
UCLASS() class UDcTestBPDataAsset : public UDcPrimaryImportedDataAsset { GENERATED_BODY() public: UPROPERTY(EditAnywhere) FString StrField; UPROPERTY(EditAnywhere) int IntField; UPROPERTY(EditAnywhere) FName NameField; };
-
Open your text editor and copy in the JSON below, and save the file on disk:
{ "$type" : "/DcJsonAsset/DcFixture/DcTestBPDataAsset", "StrField" : "Hello DataConfig Json Asset", "IntField" : 43, }
-
Then drop the file from the explorer into "Content Browser" and it's done.
-
Say we made a mistake when editing the JSON file:
{ "$type" : "/DcJsonAsset/DcFixture/DcTestBPDataAsset", "StrField" : "Hello DataConfig Json Asset", "IntField" : 43, "NoField" : "Does not exist", // <- field doesn't exist in class }
Right click on the
Example
asset and select reimport. DcJsonAsset would report this error in the "Message Log" window: