Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

GraphicsStateCollection.LoadFromJson(json)

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Parameters

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

Returns

void True if the collection was successfully loaded, false otherwise.

Description

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.