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:
When you read from or write to the Mesh data in your code.
When you pass the Mesh to StaticBatchingUtility.Combine()
to combine the Mesh at run time.
When you pass the mesh to CanvasRenderer.SetMesh.
When you use the Mesh to bake a NavMesh using the NavMesh building components at run time.
When the Mesh is convex, you use the Mesh with a Mesh Collider, and the Mesh Collider's Transform has negative scaling (for example, (–1, 1, 1)).
When you use the Mesh with a Mesh Collider, and the Mesh Collider's transform is skewed or sheared (for example, when a rotated Transform has a scaled parent Transform).
When you use the Mesh with a Mesh Collider, and the Mesh Collider's Cooking Options flags are set to any value other than the default.
When using a Mesh with a Particle System's Shape module or Renderer module when using not using GPU instancing.
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.
See Also: StaticBatchingUtility.Combine.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Start() { Mesh mesh = GetComponent<MeshFilter>().sharedMesh; print(mesh.isReadable); } }
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.