Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Animator Always resets childobject active state to original

Discussion in 'Animation' started by Games_49Wares, Nov 26, 2021.

  1. Games_49Wares

    Games_49Wares

    Joined:
    Oct 17, 2021
    Posts:
    57
    Hey, I have the following problem: I have a gameobject (player) which has a childobject (weapon). Now when i instantiate that prefab i am checking if the player has a weapon already and if yes, the weapon object gets set active. But the animator always sets it back to inactive even if i enable the animator after setting the weapon to active. Same is for the opposide, if i have weapon active from the beginning and only deactivate it if player has no weapon yet, the animator enables it again. I checked my idle animation, it has no property that accesses the weapon active state. It even sets it back to original state when i change it manually in the running scene.
    Some help would be great and very appreciated.
     
  2. Grhyll

    Grhyll

    Joined:
    Oct 15, 2012
    Posts:
    119
    Did you try to uncheck the WriteDefault checkbox on your states?