Search Unity

AR opacity slider

Discussion in 'AR/VR (XR) Discussion' started by CTS1234, Sep 12, 2019.

  1. CTS1234

    CTS1234

    Joined:
    Aug 21, 2019
    Posts:
    3
    Hi im new to unity and im trying to figure out how to create a slider that will blend transparency between two objects. so as the slider is set to 0 the first object will be shown, through the transition of the slider the first object will fade out and the second object will fade in.

    Any thoughts on how to achieve this?

    Many thanks
     
    Pixygon likes this.
  2. Pixygon

    Pixygon

    Joined:
    May 9, 2013
    Posts:
    26
    Have each model have their own material.
    As you drag the slider from 0 to 1, tie the slider to the material alpha, then make material 1 be visible at 0, and invisible at 1, and reverse for the other object.
    material.SetColor(1, 1, 1 <alphaValue>);
    Remember to have each materials render mode set to Transparent and not Opaque!
    This would mean that with the slider on 0.5, each object would be 50% transparent.