Hello guys, i created a global game event that will spawn a game object (shield) when a weapon(is equipped), then destroy the shield when the weapon is not equipped.
In the game event, i used equipment fork condition to check if the weapon is equipped. If it is not equipped, the prefab gameobject is destroyed and the change game variable condition is called. Which sets the game variable float Equipped to 0 . If it is equipped, a check game variable condition is called, which checks if the float Equipped is less than 1.If yes then a gameobject(shield) is spawned,if no nothing is done(this is done to avoid spawning more than one shield, when the weapon is equipped). Then in the next step the game variable float Equipped is set 1.
but surprising the prefabs are not destroyed when a new weapon is equipped. Any assistance will be appreciated
  • You need to add destroy prefabs node for destroying prefabs.
  • @UserName The prefab is destroyed, as stated in my first post using destroy node. Thanks for your contribution
  • edited October 2017
    Ok 2 things you can do.

    First, leave only the destroy prefab node in your event, and see if it still doesn't work. If it doesn't, then you know it's something to do with your prefab setup, and not your equipped 1 or 0 logic.

    Second, add console line nodes with #varfloatTheNameOfYourVariable# to make sure your variables are set to the correct number, that way you can debug your event.
    Post edited by UserName on
  • Keep in mind that the prefab instance spawned by an event is only available while the event is still running - i.e. if the event is started a 2nd time, the prefab instances will no longer be linking to the spawned prefabs.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.