Not saving Game Objects inside BT

NodeCanvas Forums Support Not saving Game Objects inside BT

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13822
    joseppi
    Participant

    As the title states.
    I’ve created a simple task in a Behavior Tree with an input of a Game Objects.
    When I save the scene, close it and open it again, all the game objects inside my tasks are gone and I need to set it up again.

    Edit: for clarity

    #13841
    Gavalakis
    Keymaster

    Hello and sorry for the late reply.
    Is by any chance your graph an “Asset Reference” rather than a “Bound Graph”?
    If you graph is an “Asset Reference”, then this is normal to happen, since by “Unity standards”, assets (that live in the Project), can’t hold references to scene object (that live in the Scene Hierarchy).

    The simplest solution around this, would be to use and make the graph a “Bound Graph”. This will bind the graph with the gameobject (which lives in the scene) and thus possible to hold other scene object references.

    Another solution to this if you definetely want to use Asset Graphs, would be to use “Blackboard Variables” instead of direct assigned object refenreces. Because the “Blackboard” is a components attached on the gameobject in the scene, it CAN hold other scene object references as normal.

    Let me know if that works for you and whether or not this is indeed a case of using Asset Graph References.
    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #13961
    timv
    Participant

    Is there any way that NodeCanvas could warn about trying to use direct scene object references in Asset behaviour trees?

    #13978
    Gavalakis
    Keymaster

    @timv. In the very past, object fields of GameObject or Component type, used to be disabled when the graph in the editor was an asset, but it didnt work out well due to the case of a graph being bound to a prefab (still an asset) and trying to assign an object from that same prefab hierarchy. This should be a valid assignment, but the object field was still disabled. As such this “failsafe” was removed since it didnt work well.

    With that said, I will take another look at this though and try to fine tune this to also acomodate this case.

    Thanks.

    Join us on Discord: https://discord.gg/97q2Rjh

    #13985
    timv
    Participant

    Thanks. It’s probably not straight forward with Prefabs involved, but it would be nice to prevent this type of error, or catch it early.

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