|
Post by timseconddinner on May 30, 2023 20:12:24 GMT
I'm trying to make an editor tool that hooks into the import process and automatically creates groups for new audio files, but I can't seem to find a way to permanently create an audio group via code. I see lots of stuff around creating new groups temporarily at runtime, but my tool needs to be able to do it in editor while the game isn't even running. I can access the Master Audio Prefab directly and edit the component, but I can't seem to find a way to create a new group that I can save to the prefab and will be there long term, is that possible?
|
|
|
Post by DarkTonic Dev on Jun 1, 2023 2:53:28 GMT
It would probably be easy if you call the methods that exist in the Inspector classes for when the user drags in an Audio Clip to create groups, no? They might be private. Test making them public.
Is that something you're thinking of selling or just for yourself?
|
|
|
Post by timseconddinner on Jun 1, 2023 14:36:02 GMT
Just internal for our studio use
|
|
|
Post by DarkTonic Dev on Jun 1, 2023 14:38:44 GMT
Ok. Let me know if you get stuck after trying my comments.
|
|
|
Post by timseconddinner on Jun 2, 2023 18:14:05 GMT
chose to just copy some of it out of the plugin so when we update the plugin we won't have to redo everything hopefully. Thanks for the advice though!
|
|
|
Post by DarkTonic Dev on Jun 2, 2023 22:01:45 GMT
No problem, that should work for awhile.
|
|
|
Post by timseconddinner on Jun 8, 2023 21:50:42 GMT
Hmmm, I'm seeing a way to create audio groups, but not seeing a way to edit them via code, all I need to be able to do currently is swap out the audio clip for a group without changing anything else about it, is that something that is doable currently? I know in editor you can drag a new one in but can't seem to find where that code lives or if it's something that is already accessible to me.
|
|
|
Post by timseconddinner on Jun 8, 2023 21:51:27 GMT
I can already get a direct reference to the MasterAudioGroup component but it doesn't seem to have what I need to swap the clips?
|
|
|
Post by DarkTonic Dev on Jun 9, 2023 13:01:30 GMT
At runtime? No, there's no code for that. There is an API to add a new Variation but not to edit one.
|
|
|
Post by timseconddinner on Jun 12, 2023 15:07:46 GMT
What about the UI code? I couldn't seem to find what code I'd need to copy there either even from non runtime code. None of this will be happening at game runtime, just editing prefabs on import.
|
|
|
Post by timseconddinner on Jun 12, 2023 17:51:44 GMT
Ok I think I found a way using the group variations and assetReferences. What I'm trying to figure out now is how to set the group bus, we have the string values of them, but is there a way to access all created group buses in order to search them and find the index?
|
|
|
Post by DarkTonic Dev on Jun 13, 2023 2:10:08 GMT
See if this works. In MasterAudio.cs
/// <summary> /// This returns of list of all Buses. /// </summary> public static List<GroupBus> GroupBuses { get { return Instance.groupBuses; } }
Actually, you probably want this one.
/// <summary> /// This will return a list of all the Bus names, including the selectors for "type in" and "no bus". /// </summary> public List<string> BusNames { get { var busNames = new List<string> { DynamicGroupName, NoGroupName };
// ReSharper disable once ForCanBeConvertedToForeach for (var i = 0; i < groupBuses.Count; i++) { busNames.Add(groupBuses.busName); }
return busNames; } }
|
|