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. Dismiss Notice

Question Possible Bug - Multi-Parent Constraint - Unable to set source object weight at runtime

Discussion in 'Animation Rigging' started by BlackBunnyCrankn, Sep 24, 2021.

  1. BlackBunnyCrankn

    BlackBunnyCrankn

    Joined:
    Mar 21, 2020
    Posts:
    21
    Setup:
    upload_2021-9-24_20-45-0.png

    Code in a function

    WeightedTransformArray a = TertiaryWeaponRig.data.sourceObjects;
    a.SetWeight(0, 1f);
    a.SetWeight(1, 1f);
    TertiaryWeaponRig.data.sourceObjects = a;

    I have tested to insure the sourceobjects (weaponPivot/WeaponSlot) are in the sourceobjects object when running. When the script runs the weight is not set. I have tried everything i have found online and i have not been able to get multi-parent constraints source objects weight to change at run time.

    Is this a bug or am i doing something incorrectly?
     
    Last edited: Sep 24, 2021
    DungDajHjep likes this.
  2. BlackBunnyCrankn

    BlackBunnyCrankn

    Joined:
    Mar 21, 2020
    Posts:
    21
    I found that the problem is when you set the weight in a function or a coroutine. This function above only works if you run it in a update function. This seems really silly to me.

    Coroutines run after update therefor i dont know if it is possible to set the weight outside of a update that runs every single frame.

    Does anybody have any ideas?