| Parameter | Description |
|---|---|
| json | The JSON-formatted string that represents a serialized GraphicsStateCollection object. |
void True if the collection was successfully loaded, false otherwise.
Load a GraphicsStateCollection from the provided JSON-formatted string.
The file extension of GraphicsStateCollection is *.graphicsstate.
Additional resources: SaveToFile, LoadFromFile.
using System.IO; using UnityEngine; using UnityEngine.Rendering;
public class LoadFromJsonExample : MonoBehaviour { public GraphicsStateCollection graphicsStateCollection; public string jsonFilePath;
void Start() { graphicsStateCollection = new GraphicsStateCollection(); string serializedJson = File.ReadAllText(jsonFilePath); if (graphicsStateCollection.LoadFromJson(serializedJson)) { Debug.Log("graphicsStateCollection contains " + graphicsStateCollection.totalGraphicsStateCount + " graphics states."); } } }
Additional resources: SaveToFile.