Description
The RootObject
property of the PrefabFile
class provides access to the root JSON object that represents the structure and data of the prefab. This property is of type System.Text.Json.Nodes.JsonObject
, allowing for manipulation and retrieval of JSON data within the prefab file.
Usage
Use the RootObject
property to access or modify the JSON data of a prefab. This can be useful for dynamically changing prefab properties or reading configuration data stored in the prefab.
Example
// Example of accessing the RootObject property
PrefabFile prefab = new PrefabFile();
JsonObject rootJson = prefab.RootObject;
// Example of modifying a value in the RootObject
rootJson["SomeProperty"] = "NewValue";
// Example of reading a value from the RootObject
string someValue = rootJson["SomeProperty"].ToString();