Forráskód Böngészése

Fixed some secondary bugs related to buttons spawning

jamesperet 2 éve
szülő
commit
6f3c2f5abe
3 módosított fájl, 13 hozzáadás és 3 törlés
  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.
 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()
         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++)
             for (int i = 0; i < prePopulateButtons; i++)
             {
             {
                 GameObject obj = Instantiate(storyBranchPrefab, branchContainer);
                 GameObject obj = Instantiate(storyBranchPrefab, branchContainer);
@@ -115,7 +125,7 @@ namespace KairoEngine.StorySystem.UI
         {
         {
             if(buttons != null)
             if(buttons != null)
             {
             {
-                for (int i = storyStep.branches.Count; i < buttons.Count; i++) 
+                for (int i = 0; i < buttons.Count; i++) 
                 {
                 {
                     //Destroy(buttons[i]);
                     //Destroy(buttons[i]);
                     buttons[i].SetActive(false);
                     buttons[i].SetActive(false);

+ 1 - 1
package.json

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