Search Unity

Feedback Setting Stretch-UV of SpriteShapeController in Code

Discussion in '2D' started by BTStone, Aug 11, 2020.

  1. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Hey there

    using Unity 2019.4.1f1
    using SpriteShape 3.0.12

    When you add a SpriteShapeController component to a GameObject you can check the bool value "Stretch UV" in order to...well..stretch the UV.
    I wanted to set this in code, but apparently it's not possible.
    There is no exposed property for it. I can set the actual stretchTiling value in code, but not if it should actually stretch or not, which does nothing if I change it in code until the bool is set in the inspector.

    So please expose the "Stretch UV"-bool property asap :)
     
  2. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    It's been months. Did something happen related to the issue. I looked at the Changelog of SpriteShape but there was no indication if the property was exposed.
     
  3. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Bump.

    Updated Engine and Package,
    Using Unity 2020.2.4f1
    Using SpriteShape 5.1.1

    Nothing changed, the Stretch-UV property is still not exposed. Is there any reason for this? @rustum
     
  4. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    Sorry for the delay in response. We will add this in the upcoming version and post an update when it gets published. Thanks.
     
    BTStone likes this.
  5. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Coolio, thanks for that, highly appreciated! :)
     
  6. srslylawl

    srslylawl

    Joined:
    Oct 7, 2019
    Posts:
    5
    ran into the same issue today - still can't be set in code. going over every asset and setting it in the inspector seems backwards - any convoluted workarounds for now?
     
    april_4_short likes this.
  7. srslylawl

    srslylawl

    Joined:
    Oct 7, 2019
    Posts:
    5
    Update: found a wacky workaround by modifying the serialized value directly, using this called in OnValidate on the SpriteShapeController component:

    Code (CSharp):
    1. var so = new SerializedObject(_spriteShapeController);
    2. so.FindProperty("m_StretchUV").boolValue = true;
    3. so.ApplyModifiedProperties();
     
    Last edited: Aug 5, 2021