Author Topic: How to control alpha use slider  (Read 3593 times)

jeaky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
How to control alpha use slider
« on: March 16, 2013, 12:49:16 PM »
Hi, I want use slider to control the alpha value, but I don't know how to write the code, I have writed some code bellow but not have any change in the scene. Anyone help me plz ?

var slider : float = 1;
var v1 : GameObject;

function OnSliderChange () {

     v1.renderer.material.color.a = slider;

}

jeaky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: How to control alpha use slider
« Reply #1 on: March 18, 2013, 05:50:02 PM »
any help?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to control alpha use slider
« Reply #2 on: March 18, 2013, 08:05:42 PM »
Widgets don't have a renderer. Get the UIWidget component and modify its alpha property.