How to build a ui similar to that?
I cannot get values from audio player to linear guage.
Hi @PQuest ,
There is no direct simple binding possible, you have to implement some extra steps to make it work.
Just to explain, in the Audio Asset, two values are exposed Total time and Current time, see below.
These values are formatted like
On the other hand, the linear Gauge is using 2 properties to be displayed properly: Value and Full value, see below.
The method we’re going to use here is:
- Add your Audio Asset in the scene (you can put it out of the scene so it’s not visible)
- Create 2 Text Assets bound to the Audio Asset Total Time and Current Time with a Custom Script Converter for each of these bindings
The Custom Script Converter will be:
It will convert a duration like
HH:mm:ss.sss into an Integer being total value in seconds.
- then bind the values of the 2 Text Asset to the Linear Gauge
And voilà, you’re good to go!
It may seems long but I went with a full explanation here, for real in Composer, it just takes 5 minutes
I made a quick demo sample XP, find it attached.
Community-AudioToLinearGauge.zip (7.5 MB)
wow thanks a lot . this explains why the linear gauge doesn’t work. i thought the time was just formatted in seconds