Browse Source

Fix some BG items not instantiating on scene load

Props that load with BgMgr.CreateAssetBundle were not loading
habeebweeb 4 years ago
parent
commit
16db905b17
1 changed files with 6 additions and 11 deletions
  1. 6 11
      MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Update.cs

+ 6 - 11
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Update.cs

@@ -4831,18 +4831,13 @@ namespace CM3D2.MultipleMaids.Plugin
                                 else if (!str1.StartsWith("mirror") && str1.IndexOf(":") < 0)
                                 {
                                     Object original2;
-                                    if (str1.StartsWith("BG"))
-                                    {
-                                        string name = str1.Replace("BG", "");
-                                        original2 = GameMain.Instance.BgMgr.CreateAssetBundle(name);
-                                        if (original2 == null)
-                                        {
-                                            original2 = Resources.Load("BG/" + name);
-                                        }
-                                    }
-                                    else
+                                    bool isBG = str1.StartsWith("BG");
+                                    string name = isBG ? str1.Replace("BG", "") : str1;
+
+                                    original2 = GameMain.Instance.BgMgr.CreateAssetBundle(name);
+                                    if (original2 == null)
                                     {
-                                        original2 = Resources.Load("Prefab/" + str1);
+                                        original2 = Resources.Load((isBG ? "BG/" : "Prefab/") + name);
                                     }
 
                                     original1 = Instantiate(original2) as GameObject;