소스 검색

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": {