Returns true if the Mesh is read/write enabled, or false if it is not.
When a Mesh is read/write enabled, Unity uploads the Mesh data to GPU-addressable memory, but also keeps it in CPU-addressable memory. When a Mesh is not read/write enabled, Unity uploads the Mesh data to GPU-addressable memory, and then removes it from CPU-addressable memory.
You can set this value using the Read/Write Enabled checkbox when importing a model to Unity. To set the value to false at run time, set the markNoLongerReadable
argument of Mesh.UploadMeshData.
In most cases, you should disable this option to save runtime memory usage. You should only enable it under the following circumstances:
StaticBatchingUtility.Combine()
to combine the Mesh at run time.Note that the Particle System will automatically change Meshes to readable when assigned through the inspector
Notes:
When Unity creates a Mesh from script, this value is initially set to true.
Meshes not marked readable will throw an error on accessing any data arrays from script at runtime.
Access is always allowed in the Unity Editor outside of the game and rendering loop, regardless of this setting.
Additional resources: StaticBatchingUtility.Combine.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Start() { Mesh mesh = GetComponent<MeshFilter>().sharedMesh; print(mesh.isReadable); } }