Thursday, 17 May 2018

how to use slider in unity


first goto -> create -> UI -> slider and create a slider this will create a canvas if not already created.
create a script and attach it to any gameobject (payer or camera) or just put the code in any script
assing the public slider variable in inspector by draging the slider component from hierarchy to inspector as shown below.

now run the code after running you will notice the slider value will change to 10 as written in code.

No comments:

Post a Comment