Browse Source

Fix COM3D2 root BG gameobject getting destroyed

habeebweeb 4 years ago
parent
commit
a88b7670c2

+ 2 - 3
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragDogu.cs

@@ -20,10 +20,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public bool keepDogu = false;
         public float scaleFactor = 1f;
 
-        public void Initialize(GameObject dogu)
+        public void Initialize(GameObject dogu, bool keepDogu = false)
         {
-            Initialize(dogu, false, GizmoMode.World,
-                () => this.dogu.transform.position,
+            Initialize(dogu, keepDogu, GizmoMode.World,
                 () => Vector3.zero
             );
         }

+ 2 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EnvironmentManager.cs

@@ -76,7 +76,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             );
 
             bgDragPoint = dragPoint.AddComponent<DragDogu>();
-            bgDragPoint.Initialize(bgObject);
+            bgDragPoint.Initialize(bgObject, true);
             bgDragPoint.SetDragProp(false, false, false);
 
             cameraObject = new GameObject("subCamera");
@@ -108,6 +108,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void Deactivate()
         {
+            if (bgDragPoint != null) GameObject.Destroy(bgDragPoint.gameObject);
             GameObject.Destroy(cameraObject);
             GameObject.Destroy(subCamera);