Setting a Variable works in Editor but not in the Build

Forums 💬 NodeCanvas ⚙️ Support Setting a Variable works in Editor but not in the Build

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16888
    khalreon
    Participant

      So i have a macro which has input variables and 2 float output variables which i use to change the bb variable of the FSM. FSM has 4 flow script states. Inside 2-3 of these flow scripts i have this macro doing some changes to the variables. The variable change is dependent on a node that i made myself. What could i be doing wrong?

      ProgresserNode.cs –

      #16893
      khalreon
      Participant

        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.

        #16892
        Gavalakis
        Keymaster

          Hello 🙂

          Hmm.. In your 2nd node code, I just tried changing the progress from being a BBParameter and into a normal float, and the node worked just fine as well, meaning that it correctly increases and outputs the progress each time “In” is called.

          Can you please confirm?
          Thank you!

          #16891
          khalreon
          Participant

            But the thing is from a nested flowScript i am changing the progress value as you can see from attached images. And in editor 1st code was working just fine. And all the effect was correct. But in the build it was always staying in the value it left after reaching min/max. Problem is with my node yes, but i still don’t know why would it work in the editor and not in build that’s the problem. Anyways i wanted to put ValueInput<float> cause i wanted to be able to use it in a macro. But now i can only use it directly in the flowScript itself since the reference to parameter of BB is required to be directly set cause i am using BBParameter<float>. I do not want to use System.float since i want to use progress parameter i can reach from other nested flowScripts.

            #16890
            khalreon
            Participant

              Alright found the problem.

              Apparently Port.isConnected only works in editor. Not in the build. So because the value always returns false in Build it always uses it’s own value which after reaching min-max either 0 or 1.

              So i added a public bool which says useInputValue if ticked input value is used, if not ticked BBParameter is used for progress calculation.
              So how can the script know in build, if the port was connected or not?

              #16889
              Gavalakis
              Keymaster

                Hello,

                Indeed, .isConnected only works in the build. This is initially done for performance reasons, but I could make a work around if required to also make it available in build. Truth is, that none of the nodes I’ve made for FC required the isConnected property, but I can understand that there can be some usage for that.
                For instance, you could simply change your code from this:

                To simply this:

                If, input_progress is not connected, then the direct value set in the inspector of the node will be used, which can of course be left to the default zero. The whole concept here, would be to automatically use the connected value if there is indeed a connection, otherwise use the directly set value instead 🙂

                Having said that and as stated above, if you want I can take a look at making isConnected available in build as well.

                Thanks!

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.