文档

Unity Engine

Unity Engine

LoadFromFile(string)

Load the GraphicsStateCollection at the given path.
阅读时间1 分钟最后更新于 1 个月前

Definition

public bool LoadFromFile(string filePath)

Parameters

filePath

Location of the GraphicsStateCollection file.

Returns

Type

Description

boolTrue 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.
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.