Quests not loading (they are saving though)

Announcements, support questions, and discussion for Quest Machine.
joshualoveridge
Posts: 19
Joined: Tue Jan 01, 2019 12:53 am

Re: Quests not loading (they are saving though)

Post by joshualoveridge »

Absolute legend <3
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quests not loading (they are saving though)

Post by Tony Li »

Hi,

Here's the MultiActiveSaver package:

MultiActiveSaver_2020-03-07.unitypackage
joshualoveridge
Posts: 19
Joined: Tue Jan 01, 2019 12:53 am

Re: Quests not loading (they are saving though)

Post by joshualoveridge »

Thanks Tony!!
joshualoveridge
Posts: 19
Joined: Tue Jan 01, 2019 12:53 am

Re: Quests not loading (they are saving though)

Post by joshualoveridge »

I made a little editor script also that might help some people :)
just means i dont have to go in and add everything manually !

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers;
using PixelCrushers.QuestMachine;
using UnityEditor;



class MultiActiveSaverEditor : EditorWindow
{
   public MultiActiveSaver value;

 [MenuItem("Window/JOSH-ADDALL OBJECTS FOR SAVE")]
     public static void ShowWindow()
     {
         GetWindow<MultiActiveSaverEditor>("Add All Items to multi saver");
         
     }
 
     private void OnGUI()
     {

          EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("MultiActiveSaverObject");
        value = EditorGUILayout.ObjectField(value, typeof(MultiActiveSaver), true) as MultiActiveSaver;
            EditorGUILayout.EndHorizontal();
        
        EditorGUILayout.BeginVertical();

         if (GUILayout.Button("Run Function"))
         {
             OnInspectorGUIs();
         }
        EditorGUILayout.EndVertical();

     
     }
 

public void  OnInspectorGUIs () 
  {
    // specifiedObject is the 'parent', with whos children you want to populate the array. has to be public
    if (value.gameObject == null)
    {
    //  throw new Exception ("Specified object is null");
    }

    // targetArray is the array you want to populate with children. has to be public
    // simple population alg
    // value.gameObjectsToWatch = new GameObject[value.Referenceobj.transform.childCount];
    // for (int i = 0; i < value.gameObject.transform.childCount; i++)
    // {
    //   value.gameObjectsToWatch[ i ] = value.Referenceobj.transform.GetChild( i ).gameObject;
    // }



          Transform[] t = value.Referenceobj.GetComponentsInChildren<Transform>(true);
          
          value.gameObjectsToWatch = new GameObject[t.Length];
          int i = 0;
     foreach (Transform yourScript in t) {
         value.gameObjectsToWatch[i] = yourScript.gameObject;
         i++;
     }
  }
    }

User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quests not loading (they are saving though)

Post by Tony Li »

Thanks for sharing!
Post Reply