[BUG?] Cannot set public graph variable to GameObject on Prefab

Forums 💬 NodeCanvas ⚙️ Support [BUG?] Cannot set public graph variable to GameObject on Prefab

  • This topic has 0 replies, 3 voices, and was last updated 5 years ago by zsoik.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #16298
    guyboots_thunderbro
    Participant

      The documentation for public graph variables mention that they can be overridden on a per-GameObject basis + etc without modifying the graph serialization.

      Let’s assume this Prefab

      + Bad Guy
      –> Detection Radius (CircleCollider2D)

      And an asset graph with an exposed variable Detector (Collider2D).

      If I drag Bad Guy into a scene, override Detector, and assign Detection Radius to it, things work fine.

      If I open the Bad Guy prefab in Prefab Mode, override Detector, and assign Detection Radius to it, I get a message saying that I cannot reference scene objects in an Asset.

      Is this an oversight, or just how things are?

      #16302
      zsoik
      Participant

        Do you override the variable in the blackboard attached to the GameObject “Bad Guy” or do change the reference on the internal blackboard of the graph? The latter is stored in the graph asset, whereas the former is living on the GO (and in the prefab).

        #16301
        Gavalakis
        Keymaster

          Hello,

          Considering I understood correctly, the message shown in the graph editor is a known GUI-only bug that exists because of the variable previewing the overridden value. The GUI inspector code “sees” a Unity Object being referenced in an asset and as such shows that message, which is a false positive since things will still work fine in runtime after all (please confirm that this is indeed the case for you too).

          I have “fixed” that by basically removing the exposed variables override value from being previewed in the next version unfortunately , since that was creating a lot of confusion. The one you mentioned being one of them and another confusion being when editing multiple GraphOwner prefab instances using the same Asset Graph but having different exposed variable overrides (there is a GUI-only bug there as well).

          Thank you.

          #16300
          guyboots_thunderbro
          Participant

            > …which is a false positive since things will still work fine in runtime after all (please confirm that this is indeed the case for you too).

            I can confirm that it worked when I tried it — just wasn’t sure if it’d _keep_ working.

            Thanks for the confirmation, guys!

            #16299
            Gavalakis
            Keymaster

              Thank you for the follow up and confirmation 🙂

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