NodeCanvas Forums › Support › Setting a Variable works in Editor but not in the Build › Reply To: Setting a Variable works in Editor but not in the Build
I changed my progresser node to this and it seems to have fixed the issue.
I am investigating further but if anybody know or have an idea of the cause of it, i would be glad to know.
I was using ValueInput<float> for progress float. And i switched it to BBParameter<float>. And honestly this works much cleaner but still the cause is important.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
using System.Collections; using System.Collections.Generic; using NodeCanvas.Framework; using ParadoxNotion.Design; namespace FlowCanvas.Nodes { [Name("Progresser")] [Category("Value Manipulator")] [Description("Change the value based on incrementation.")] public class ProgresserNode : FlowControlNode { public BBParameter<float> progress; private float percentage; private FlowOutput flowOut; private FlowOutput reached; private FlowInput flowIn; private ValueInput<float> input_minimum; private ValueInput<float> input_maximum; private ValueInput<float> input_increment; private ValueInput<bool> input_isReverse; private ValueOutput<float> output_progress; private ValueOutput<float> output_percentage; private void CalculateProgress(Flow f) { float change = input_increment.value; if (input_isReverse.value) { change *= -1; } float beforeChange = progress.value; progress.value += change; float afterChange = progress.value; percentage = (progress.value - input_minimum.value) / (input_maximum.value - input_minimum.value); if(afterChange > beforeChange) { if(progress.value > input_maximum.value) { progress.value = input_maximum.value; f.Call(reached); } } else { if(progress.value < input_minimum.value) { progress.value = input_minimum.value; f.Call(reached); } } f.Call(flowOut); } protected override void RegisterPorts() { input_minimum = AddValueInput<float>("Minimum").SetDefaultAndSerializedValue(0); input_maximum = AddValueInput<float>("Maximum").SetDefaultAndSerializedValue(1); input_increment = AddValueInput<float>("Increment").SetDefaultAndSerializedValue(0.1f); input_isReverse = AddValueInput<bool>("Is Reverse").SetDefaultAndSerializedValue(false); flowIn = AddFlowInput("In", CalculateProgress); flowOut = AddFlowOutput("Out"); reached = AddFlowOutput("Reached"); output_progress = AddValueOutput<float>("Progress", () => progress.value); output_percentage = AddValueOutput<float>("Percentage", () => percentage); } } } |