j7
New Member
Posts: 20
Posts: 20
|
Post by j7 on Dec 9, 2020 16:03:42 GMT
Can you advise if there is a public value to get the time left from the current playlist clip being played. ive looked through and cant seem to find it... yet if i run the project - and look at the playlist controller in the editor - i can see both the time running and time left. ive tried to grab ActiveAudioSource.clip.length and the manually subtracting ActiveAudioSource.time from the PlaylistController object - but i get inconsistent results. Mostly the .length returns zero. Any ideas? Thanks Attachments:
|
|
|
Post by DarkTonic Dev on Dec 9, 2020 16:51:11 GMT
I don't know why that would return zero unless nothing is playing or maybe it's not available if you marked the clip as streaming?
That all looks correct.
|
|
j7
New Member
Posts: 20
Posts: 20
|
Post by j7 on Dec 10, 2020 2:44:55 GMT
Ive since recompiled - and it now works! At least i know im using the right varibles. I take it there is no public varible exposed which has the 'timeleft' ? Another thing... Ive had to modify one of the playmaker scripts - because i was getting problems with it. The MasterAudioPlaylistFade if i had the checkbox ticked for 'all playlist controllers' i kept getting an exception error saying it couldnt find the controller object. even though i only had one in my project. This happened just recently, and i couldnt track it down why or when; and given i had used this function in a lot of places, i ended up removing the tickbox and code out of the script. I know i could have just gone through my whole project and 'unticked' the option - but it was dotted across lots of Game objects; and so this was a quicker way to fix.
|
|
|
Post by DarkTonic Dev on Dec 10, 2020 4:10:11 GMT
Weird. No, there is no method for that.
Can you send me your modified custom action so I can consider including it in the next update?
|
|
j7
New Member
Posts: 20
Posts: 20
|
Post by j7 on Dec 11, 2020 3:44:01 GMT
Here is the script... its just commenting out a few of the items for the fade all controllers option.
If you want i could put it back .. and show you the exception error im getting when 'ticked'.
using DarkTonic.MasterAudio; using UnityEngine; using HutongGames.PlayMaker; using TooltipAttribute = HutongGames.PlayMaker.TooltipAttribute;
[ActionCategory(ActionCategory.Audio)] [Tooltip("Fade the Playlist volume in Master Audio to a specific volume over X seconds.")] public class MasterAudioPlaylistFade : FsmStateAction { // [Tooltip("Check this to perform action on all Playlist Controllers")] // public FsmBool allPlaylistControllers; [Tooltip("Name of Playlist Controller to use. Not required if you only have one.")] public FsmString playlistControllerName;
[RequiredField] [HasFloatSlider(0, 1)] [Tooltip("Target Playlist Volume")] public FsmFloat targetVolume;
[RequiredField] [HasFloatSlider(0, 10)] [Tooltip("Amount of time to complete fade (seconds)")] public FsmFloat fadeTime;
public override void OnEnter() { // if (allPlaylistControllers.Value) { // var pcs = PlaylistController.Instances;
// for (var i = 0; i < pcs.Count; i++) { // MasterAudio.FadePlaylistToVolume(pcs[i].name, targetVolume.Value, fadeTime.Value); // } // } else { if (string.IsNullOrEmpty(playlistControllerName.Value)) { MasterAudio.FadePlaylistToVolume(targetVolume.Value, fadeTime.Value); } else { MasterAudio.FadePlaylistToVolume(playlistControllerName.Value, targetVolume.Value, fadeTime.Value); } }
Finish(); }
public override void Reset() { // allPlaylistControllers = new FsmBool(false); playlistControllerName = new FsmString(string.Empty); targetVolume = new FsmFloat(); fadeTime = new FsmFloat(); } }
|
|
|
Post by DarkTonic Dev on Dec 11, 2020 5:49:43 GMT
Yes please, the original plus the error you are getting would be useful.
|
|