示例#1
0
        void UpdateDisplayObject()
        {
            if (Scene == null)
            {
                return;
            }

            var import = ObjectOfPreview as Component_Import3D;

            if (import != null)
            {
                if (displayObject == null || displayObjectVersion != import.VersionForPreviewDisplay || materialPreviewMeshUsed != ProjectSettings.Get.MaterialPreviewMesh.Value)
                {
                    Scene.Enabled = false;

                    if (displayObject != null)
                    {
                        displayObject.RemoveFromParent(false);
                        displayObject.Dispose();
                    }

                    displayObject        = import.CreateForPreviewDisplay(Scene, out onlyOneMaterial, out _);
                    displayObjectVersion = import.VersionForPreviewDisplay;

                    Scene.Enabled = true;

                    materialPreviewMeshUsed = ProjectSettings.Get.MaterialPreviewMesh.Value;
                }
            }
        }
 void DestroyDisplayObject()
 {
     if (displayObject != null)
     {
         displayObject.RemoveFromParent(false);
         displayObject.Dispose();
         displayObject = null;
         displayObjectTransformBySourceMesh = null;
     }
 }