Version: 2021.1
LanguageEnglish
  • C#

MeshUpdateFlags.DontNotifyMeshUsers

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

Description

Indicates that Unity should not notify Renderer components about a possible Mesh bounds change, when you modify Mesh data.

When you modify Mesh data that could affect the geometry of the mesh, Unity's default behaviour is to notify all Renderer components that use this mesh, so that they can perform recalculations based on the new data that are typically desirable. For example, MeshRenderer components recalculate their bounding boxes, and the ShapeModule rebuilds internal data used for mesh surface emission.

If you supply the MeshUpdateFlags.DontNotifyMeshUsers flag when using the "advanced" Mesh API, Unity will omit these notifications. This can be beneficial to performance when you know that many mesh modifications will happen before the renderer components actually need to update.

You must therefore make sure that you call Mesh.MarkModified at a later point to notify the dependent renderer components that they should perform their recalculations.

You can use this flag with the following "advanced" mesh API: Mesh.SetVertexBufferData, Mesh.SetIndexBufferData or Mesh.SetSubMesh

For information about the difference between the simpler and more advanced methods of assigning data to a Mesh from script, see the notes on the Mesh page.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961