NodeCanvas Forums › General Discussion › Passing information between Dialogue Tree and Scene › Reply To: Passing information between Dialogue Tree and Scene
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
using NodeCanvas.Framework; using ParadoxNotion.Design; using NodeCanvas.DialogueTrees; using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; namespace NodeCanvas.Tasks.Actions { [Icon("InputField", IconAttribute.Mode.AppendToTitle)] [Category("Dialogue")] [Description("Input field which is filled by player")] public class RequestInputField : ActionTask { [SerializeField] public List<InputFieldAttributes> inputFields = new List<InputFieldAttributes>(); private MultipleInputFieldRequestInfo inputFieldInfo; private int numOfInputFieldGroups; private int inputFieldGroupsCounter; protected override void OnExecute() { numOfInputFieldGroups = inputFields.Count % 3 == 0 ? (inputFields.Count / 3) : (inputFields.Count / 3) + 1; inputFieldInfo = new MultipleInputFieldRequestInfo(inputFields, numOfInputFieldGroups, true, OnInputFieldFills); List<Node> parentNodes = DialogueTree.GetCurrentNode().GetParentNodes(); inputFieldInfo.showLastStatement = parentNodes.Count > 0 && parentNodes[0] is StatementNode; } protected override void OnUpdate() { if (inputFieldGroupsCounter < numOfInputFieldGroups) { if (!inputFieldInfo.isNext) { return; } } if (inputFieldInfo.isNext) { inputFieldInfo.isNext = false; inputFieldGroupsCounter++; inputFieldInfo.counter = inputFieldGroupsCounter; DialogueTree.RequestInputFields(inputFieldInfo); } } public void OnInputFieldFills() { EndAction(true); } } } |
Here is my action task. I have a separate method to EndAction that I want to call in a different script that looks like this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
using System.Collections; using System.Collections.Generic; using NodeCanvas.Framework; using NodeCanvas.Tasks.Actions; using UnityEngine; public class EndAction : MonoBehaviour { public RequestInputField testbuttonscript; public void MoveOn(){ testbuttonscript.OnInputFieldFills(); } } |
I keep getting that Null reference exception, so I guess my question is, how do I reference the action I want to end, if EndAction() only takes a bool?