[BUG] CheckVariable broken?

Forums 💬 NodeCanvas ⚙️ Support [BUG] CheckVariable broken?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16383
    guyboots_thunderbro
    Participant

      I have a Transform on my Blackboard called “Target” that is set to a GameObject’s transform. When the GameObject is destroyed in the scene, the Blackboard correctly recognizes that “Target” is now null.

      However, the CheckVariable<T> condition transition that compares “Target” to NONE thinks that “Target” is not null.

      Under the hood, in CheckTransform<T>.OnCheck(), valueA.value evaluates to "null" (a string with the contents of “null”) rather than null, which causes this problem.

      I’m on NodeCanvas 3.0.5.

      #16388
      Gavalakis
      Keymaster

        Hey,

        The problem stems from how Unity treats UnityEngine.Objects when they are deleted. I have added a special case in the CheckVariable to handle this situation and attached the fixed package for you here.

        Let me know if that works for you.

        Thanks 🙂

        #16387
        guyboots_thunderbro
        Participant

          > Let me know if that works for you.

          Seems to work, thanks!

          I notice that ObjectUtils.AnyEquals is also used in a few other places in the codebase — I haven’t seen any bugs from it yet, but do they need the same fix?

          #16386
          Gavalakis
          Keymaster

            I will run a code review regarding this and let you know (as well as fix it) if anything comes up 🙂

            Thanks!

            #16385
            guyboots_thunderbro
            Participant

              Confirming that some other areas that use ObjectUtils.AnyEquals, such as BBParameter.isNull, are affected by this.

              #16384
              Gavalakis
              Keymaster

                Thank you for the report.

                The source of the issue mostly comes from the fact that when a Unity object is destroyed, it is still kept referenced (which is normal). A more proper workaround fix for this would be to please open up ObjectUtils.cs and change method AnyEquals to this:

                This should handle the null checks with unity objects better and of course for all cases AnyEquals method is used (thus no need for the first fix I sent you any longer)

                Let me know if that works for you.
                Thanks 🙂

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