Search Unity

Question MultiParentConstraints Setting source object weights at runtime not working

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

  1. BlackBunnyCrankn

    BlackBunnyCrankn

    Joined:
    Mar 21, 2020
    Posts:
    21
    Setting MultiParentConstraints source objects weight at run time in c#. Weight not changing - Version 2020.3.19f1.

    Set up:
    Scene:
    upload_2021-9-24_1-16-17.png


    Code:
    public MultiParentConstraint TertiaryWeaponRig;

    public void Update() {
    WeightedTransformArray a = TertiaryWeaponRig.data.sourceObjects;
    a.SetWeight(0, 1f);
    a.SetWeight(1, 1f);
    TertiaryWeaponRig.data.sourceObjects = a;
    }


    The weight is getting set in the WeightedTransformArray. However when i set it to the multiparentconstraints source objects the weight is not being set in the original object. I checked to make sure the multiparentConstraint is getting set and the index (0,1) are set to the correct indexes.

    Any help would be great.