Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DuplicateEditorMesh performance issue
#1
Exclamation 
Hi!

I was testing Curvy Spline and noticed that there is a huge amount of time spent inside DuplicateEditorMesh.Awake when you have a scene with a lot of object (and DuplicateEditorMesh component in the scene).

For example, for 770 DuplicateEditorMesh component in a scene, you'll get ~5000 ms spent in possibly doing nothing in that method.

Just because we are consistently make use of FindObjectsOfType<DuplicateEditorMesh>() and iterating through the result to find potential identical sharedMesh.

Do you have already encountered performance issue with that compoenent?
(well with inheriting components too, like CGMeshResource in my case).

If that Awake method is onlt here to catch duplicate in Editor, why not using the OnValidate and check the Event.type to catch Paste and Duplicate commands?

Also, instead of constently calling FindObjectsOfType, will it be more efficient to maintain (only in Editor) a list of Awaken component of that type?


Thanks for your shared experience!




Here is the DuplicateEditorMesh.Awake code:
Code:
        protected virtual void Awake()
        {
            if (!Application.isPlaying)
            {
                MeshFilter meshFilter = Filter;
                if (meshFilter && meshFilter.sharedMesh != null)
                {
                    DuplicateEditorMesh[] otherWatchdogs = GameObject.FindObjectsOfType<DuplicateEditorMesh>();
                    foreach (DuplicateEditorMesh dog in otherWatchdogs)
                    {
                        if (dog != this)
                        {
                            MeshFilter otherMF = dog.Filter;
                            if (otherMF && otherMF.sharedMesh == meshFilter.sharedMesh)
                            {
                                Mesh m = new Mesh();
                                m.name = otherMF.sharedMesh.name;
                                meshFilter.mesh = m;
                            }
                        }
                    }
                }
            }
        }
Reply


Messages In This Thread
DuplicateEditorMesh performance issue - by Guillaume - 01-14-2022, 02:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I want to improve the performance of Variable Mix Shapes yanke 7 8 07-27-2023, 09:15 PM
Last Post: _Aka_
  Rotation issue with generator nicolaj.h.andersen@gmail.com 1 14 04-14-2023, 11:58 AM
Last Post: _Aka_
  BuildVolumeMesh issue tairoark 40 95 11-25-2022, 07:57 AM
Last Post: _Aka_
  Upgrading Unity causes significant performance degradation yanke 3 7 05-23-2022, 03:40 PM
Last Post: _Aka_

Forum Jump: