LoadFromFile(string)
Load the GraphicsStateCollection at the given path.
Read time 1 minuteLast updated 20 hours ago
Definition
- Type: Method
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
public bool LoadFromFile(string filePath)
Parameters
Location of the GraphicsStateCollection file.
Returns
Type | Description |
|---|---|
| bool | True if the collection was successfully loaded, false otherwise. |
Remarks
The file extension of GraphicsStateCollection is *.graphicsstate.
Note: The Web platform doesn't support this function as the file system is not accessible.
Note: In a Player, a collection loaded from a file doesn't resolve its compute shader variants, so GraphicsStateCollection.WarmUp skips them and GraphicsStateCollection.GetComputeVariants returns variants whose is . To warm up compute shaders in a Player, reference the imported .graphicsstate asset instead.
shadernullAdditional Resources: GraphicsStateCollection.SaveToFile, GraphicsStateCollection.LoadFromJson.
using UnityEngine;using UnityEngine.Rendering;public class LoadFromFileExample : MonoBehaviour{ public GraphicsStateCollection graphicsStateCollection; public string filePath; void Start() { graphicsStateCollection = new GraphicsStateCollection(); if (graphicsStateCollection.LoadFromFile(filePath)) { Debug.Log("graphicsStateCollection contains " + graphicsStateCollection.totalGraphicsStateCount + " graphics states."); } }}
Additional Resources: GraphicsStateCollection.SaveToFile.