Set active is not working

NodeCanvas Forums Support Set active is not working

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15994
    moonbeam
    Participant

    I made a simple FSM graph where the patrolling agent will deactivate a target after seeing, and also logs ‘CanSee’ in the console.

    The target gets deactivate in the hierarchy but the the agent still logsĀ  ‘CanSee’.

    I am using this method as destroy game object is causing null reference exception error

    Attachments:
    You must be logged in to view attached files.
    #15998
    Gavalakis
    Keymaster

    Hello there,

    There is indeed an omission and the CanSeeTarget code does not check whether or not the target gameobject is deactivated or not. I have just fixed this for all CanSeeTarget versions and attached the files for you here.

    Regarding checking a gameobject reference that is later destroyed the best solution for that would be to use a Blackboard Variable for that particular gameobject and check to see if the Variable is null (with the “Blackboard/Check Null” Condition Task) before calling any action that uses that potentially destroyed gameobject. By that same approach, you “Destroy Gameobject” Action Task, will of course also have to use that Variable instead of a direct gameobject reference.

    Let me know if this works for you.
    Thank you.

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

    Attachments:
    You must be logged in to view attached files.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.