Class JsonAssetBase
Base class for all Json-format assets.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public abstract class JsonAssetBase : Asset
Constructors
JsonAssetBase()
Properties
Data
The Json data (as string).
Declaration
[Unmanaged]
public string Data { get; set; }
Property Value
System.String
|
DataEngineBuild
The serialized data engine build number. Can be used to convert/upgrade data between different formats across different engine versions.
Declaration
[Unmanaged]
public int DataEngineBuild { get; }
Property Value
System.Int32
|
DataTypeName
The data type name from the header. Allows to recognize the data type.
Declaration
[Unmanaged]
public string DataTypeName { get; }
Property Value
System.String
|
Methods
GetReferences(String, out Guid[])
Parses Json string to find any object references inside it. It can produce list of references to assets and/or scene objects. Supported only in Editor.
Declaration
[Unmanaged]
public static void GetReferences(string json, out Guid[] assets)
Parameters
System.String
json
The Json string. |
System.Guid[]
assets
The output list of object IDs references by the asset (appended, not cleared). |
Init(String, String)
Initializes the virtual Json asset with custom data.
Declaration
[Unmanaged]
public bool Init(string dataTypeName, string dataJson)
Parameters
System.String
dataTypeName
The data type name from the header. Allows to recognize the data type. |
System.String
dataJson
The Json with serialized data. |
Returns
System.Boolean
True if failed, otherwise false. |
Remarks
Can be used only for virtual assets created at runtime.
Save(String)
Saves this asset to the file. Supported only in Editor.
Declaration
[Unmanaged]
public bool Save(string path = null)
Parameters
System.String
path
The custom asset path to use for the saving. Use empty value to save this asset to its own storage location. Can be used to duplicate asset. Must be specified when saving virtual asset. |
Returns
System.Boolean
True if cannot save data, otherwise false. |