Преглед на файлове

Fixed some secondary bugs related to buttons spawning

jamesperet преди 2 години
родител
ревизия
6f3c2f5abe
променени са 3 файла, в които са добавени 13 реда и са изтрити 3 реда
  1. 1 1
      Readme.md
  2. 11 1
      Runtime/UI/StoryViewUI.cs
  3. 1 1
      package.json

+ 1 - 1
Readme.md

@@ -1,4 +1,4 @@
-# 📦 KairoEngine.StorySystem v0.1.4
+# 📦 KairoEngine.StorySystem v0.1.5
 
 The Story System uses the Ink Language and runtime to navigate through a story written in a plain text file. This package contains the Story Module that receives an ink story and runs it. The story can show lines and branches, execute functions in unity and wait for events. Unity also has an API for navigating, getting and setting variables in the story.
 

+ 11 - 1
Runtime/UI/StoryViewUI.cs

@@ -56,6 +56,16 @@ namespace KairoEngine.StorySystem.UI
 
         void Start()
         {
+            if(buttons != null)
+            {
+                for (int i = 0; i < buttons.Count; i++) Destroy(buttons[i]);
+            }
+            buttons.Clear();
+            GameObject[] oldButtons = branchContainer.GetComponentsInChildren<GameObject>();
+            if(oldButtons != null)
+            {
+                for (int i = 0; i < oldButtons.Length; i++) Destroy(oldButtons[i]);
+            }
             for (int i = 0; i < prePopulateButtons; i++)
             {
                 GameObject obj = Instantiate(storyBranchPrefab, branchContainer);
@@ -115,7 +125,7 @@ namespace KairoEngine.StorySystem.UI
         {
             if(buttons != null)
             {
-                for (int i = storyStep.branches.Count; i < buttons.Count; i++) 
+                for (int i = 0; i < buttons.Count; i++) 
                 {
                     //Destroy(buttons[i]);
                     buttons[i].SetActive(false);

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
     "name": "at.kairoscope.kairoengine.story-system",
     "displayName": "KairoEngine Story System",
-    "version": "0.1.4",
+    "version": "0.1.5",
     "unity": "2020.3",
     "description": "Kairoengine story system based on the Ink language.",
     "dependencies": {