Search Unity

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:
    61
    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?