Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


LoadFromJson(string)

Load a GraphicsStateCollection from the provided JSON-formatted string.
Read time 1 minuteLast updated 4 days ago

Definition

public bool LoadFromJson(string json)

Parameters

json

The JSON-formatted string that represents a serialized GraphicsStateCollection object.

Returns

Type

Description

boolTrue if the collection was successfully loaded, false otherwise.

Remarks

The file extension of GraphicsStateCollection is *.graphicsstate.
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: GraphicsStateCollection.SaveToFile.