|
Post by benandmusic on Jan 28, 2015 4:12:16 GMT
No idea what to make of this error:
|
|
|
Post by DarkTonic Dev on Jan 28, 2015 8:23:52 GMT
It sounds like you're using a beta version of Unity 4.6. We don't support beta versions once the released version exists. Please uninstall your 4.6, download the latest 4.6.1, and install it. The error will go away. I have definitely tested on 4.6 and 4.6.1 and that error doesn't show up. Or are you using a beta of 5? Still I've tested those too. If you're using a beta of 5, let me know which beta version. There's a one star review on our Master Audio Asset Store page (https://www.assetstore.unity3d.com/en/#!/content/5607) asking the same question and rating it one star because of it. If that's you, please change your review after fixing this
|
|
|
Post by benandmusic on Jan 28, 2015 10:05:16 GMT
Looks like that did the trick. The review ain't me though. Thanks!
|
|
|
Post by DarkTonic Dev on Jan 28, 2015 23:41:31 GMT
Ok, good to hear!
|
|
|
Post by benandmusic on Jan 29, 2015 7:51:35 GMT
So I'm really new to most of Unity (I've done a couple of tutorials), and I'm having trouble using the event sound feature. If it's best that I just make a new thread, I'll do that.
I have no problem getting the music to play, but when a certain character transforms, I want the playlist to switch. I know exactly what is transforming, and looking at the prefab for the character in question, I can see the script where the transformation is being referenced (telling animations to play, etc), but I have no idea how to use this information to have master audio use that as the event. I tried looking through documentation for a while to no avail.
|
|
|
Post by DarkTonic Dev on Jan 29, 2015 8:07:45 GMT
If it happens when certain events occur (mechanim state changed, enabled, trigger etc), you can use EventSounds to change the Playlist. If not, you'll need to place a line of code in the code that starts the character transforming. Like this:
MasterAudio.ChangePlaylistByName("newPlaylistName");
Those are the 2 simplest ways. But a lot of the time, you don't really need to have more than one Playlist. You could put all the songs into one and then just play the song you want. Is there a reason you need multiple Playlists?
|
|
|
Post by benandmusic on Jan 29, 2015 21:08:53 GMT
Hmm. I can see what the script is enabling, but I dont know how to reference it.
The reason I had multiple playlists is because what I want to do is have a certain track play during normal gameplay, and when the transformation occurs, start a new track from the beginning, and when the transformation reverses, revert back to the previous track at the last known location. That might not require multiple playlists though.
Adding the line of code seemed to work just fine after a couple of tries, but the first track always ended up starting from the beginning (probably because the "last known position" setting doesnt work when switch playlists.
I tried looking the the documentation, but I couldnt get "MasterAudio.TriggerPlaylistClip(string clipName);" to work.
|
|
|
Post by DarkTonic Dev on Jan 30, 2015 0:03:19 GMT
Correct, "last known position" only works in a single Playlist. I suggest you just use a single Playlist.
TriggerPlaylistClip works fine for me. If you can't get it to work right in a single playlist, you can send me a simple project that reproduces a bug and I'll take a look. I don't think there's any bug though.
You don't "reference" a script. I'm not sure what you mean by that part. You need to go into that non-Master Audio script and add a line of code like I gave you.
|
|
|
Post by benandmusic on Jan 30, 2015 2:52:30 GMT
When you said certain events, I looked in the script for terms like "state," "trigger" and "enable" and found a line saying
beastModeEnabled = true;
Among other lines involving "beastModeEnabled", so I thought that might have been relevant.
I guess the trouble I have with TriggerPlaylistClip is that I dont know what the string clipname is. I name the playlist, so that's clear enough to me, but I'm not aware of any way of naming a particular clip. It doesnt seem to be the file name, as unity is telling me "Could not find clip 'Such and such' in current Playlist in 'PlaylistController'."
|
|
|
Post by DarkTonic Dev on Jan 30, 2015 4:50:21 GMT
I don't know what beast mode is...
Clip name is in fact the filename without the extension (mp3 etc). So to play "lead.mp3" (as long as it's in your current Playlist that's in the Playlist Controller) you would do:
MasterAudio.TriggerPlaylistClip("lead");
It works for me.
|
|
|
Post by benandmusic on Jan 30, 2015 21:43:25 GMT
I changed the file name and tried again and this time it worked. It might have been that I was trying to put the clip in the actual playlist controller, but I recall trying both. Oh well, it works now. Thanks.
The only thing is that it starts both clips from the last known position, and I want it to return to the beginning of the clip at each transformation (then to the last known position of the standard clip). Is this possible?
|
|
|
Post by DarkTonic Dev on Jan 30, 2015 23:08:16 GMT
Yeah you should never put any clips directly on the 2 Audio Sources on the Playlist Controller. It's meant to only play Playlists.
The "Song Transition Mode" is only settable at a Playlist level. It sounds like you want one song to do that and not the other. To enable that behavior, you'd need to code that yourself by subscribing to the SongChanged event on the PlaylistController and changing the position of the clip with code (or not) based on the song.
Or...you could with code reset the last known position of all songs in the Playlist to zero (beginning) when the Transformation is over (or whatever event you like). The code to do that would look like this as long as you have a single Playlist Controller:
var pl = PlaylistController.Instances[0].CurrentPlaylist; for (var i = 0; i < pl.MusicSettings.Count; i++) { var aSong = pl.MusicSettings[i]; aSong.lastKnownTimePoint = 0; // this is where it stores "Last Know Position" for the song }
Not sure if I've fully answered your question as it's a little confusing.
|
|
|
Post by benandmusic on Jan 31, 2015 19:27:24 GMT
So for what I'm looking for, think 90s JRPG. Background music plays until you get into a random encounter, battle music plays from the beginning, after that, background music resumes from last known position until another battle happens, at which point battle music starts from the beginning, then background music resumes from last known position, etc.
That's what I'm aiming for. Can I use code to set the last known position of a specific clip (rather than the entire playlist) to 0 whenever it plays?
|
|
|
Post by DarkTonic Dev on Feb 1, 2015 4:12:00 GMT
Yeah, you can do that no problem. You'll just need to put an if statement into that for loop to compare. Something like this:
var pc = PlaylistController.Instances[0]; var pl = pc.CurrentPlaylist; pc.SongChanged += delegate(string songName) { for (var i = 0; i < pl.MusicSettings.Count; i++){ var aSong = pl.MusicSettings[i]; if (aSong.clip.name == "battleMusic") { aSong.lastKnownTimePoint = 0; // this is where it stores "Last Known Position" for the song } } };
This time I've added the SongChanged event wire up code.
|
|
|
Post by benandmusic on Feb 1, 2015 4:48:51 GMT
That did the trick. Thanks for the help!
|
|