Search Unity

Question VR Controller Model Prefab Incorrect Scale during Gameplay

Discussion in 'VR' started by jonesmca92, Jun 7, 2020.

  1. jonesmca92

    jonesmca92

    Joined:
    Apr 8, 2020
    Posts:
    2
    Hi all,

    I googled a bit but couldn't find a resolution. Thanks in advance.

    I am using:
    -original HTC Vive and 2 Vive controllers
    -Unity 2019.3
    -XR Toolkit with OpenVr enabled as well

    earlier today, following a tutorial by Valem on youtube, I used a simple rectangle as the right and left hand controller prefab models. These rectangles were made by scaling a standard unity cube and adding a white color material. My first time around during gameplay they worked fine.

    I realized they were too big, and so deleted them and made new rectangles that were scaled better. Now upon gameplay, the rectangles revert back to the standard Unity 3D cube size and color. I have re-started my computer, re-started steam and re-done creating both the controller game objects and the cube prefab several times now. I am not getting any errors in the console. I have attached some images of my issue.

    Can you tell me what's going on?

    thank you in advance, C

    please check the image here:

    https://imgur.com/YA28T6Z

    https://imgur.com/FDIbtGx

    I hope the imgur links work, I was having some trouble with them.

    thanks
     
  2. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    I can't see the images but this sounds like something simple that won't require restarts etc.

    In general: Unity libraries and 3rd-party assets do not support anything being any scale except (1,1,1).

    The core engine will always render it faithfully at whatever scale you put, but decades of code (including a lot of Unity's own code!) was written badly and forgot to check scales, so assumes 1.1.1 scale at all times.

    Most likely: a script somewhere is resetting the objects you've scaled back to the default 1.1.1. scale. A lot of scripts do this to prevent bugs: scaling is *not* supported by a lot of code (and, for instance, it actively breaks physics in a lot of ways). You can usually scale individual child objects, but as soon as you make them the parent of other objects, you risk a lot of problems - so a lot of code will auto-reset scale of any parent object, and auto-reset prefabs when they're instantiated (non-1.1.1 scale prefabs are often a nightmare, they cause a lot of problems on their own).

    My guess is that first time round you scaled a child, and second time round you scaled the parent, and the parent was always getting auot-reset by another script, and now you are noticiing it but didn't notice it before.
     
    jonesmca92 likes this.
  3. jonesmca92

    jonesmca92

    Joined:
    Apr 8, 2020
    Posts:
    2
    thank you so much! I think you are probably right and I'll keep this in mind going forward. I really appreciate your thorough response.