|
Post by Nikola on Dec 1, 2023 20:27:02 GMT
Hi, I simply want to store some serialized audio references and call those from script. I'm using the [SoundGroup] Attribute for my data, but it results in making the editor slow to a crawl when scrolling or trying to change any value, which makes me assume then that this is not the way to go about it.
example code of my global audio data object:
[SoundGroup] public string EssencePickUp;
[SoundGroup] public string Explosion;
[SoundGroup] public string Block;
[SoundGroup] public string Grunt;
[SoundGroup] public string GruntDeath;
[SoundGroup] public string SpikeUp; etc.
I definitely don't want to have raw string references because that is flimsy and would need to be updated manually if I change the name of the group in the master audio prefab. How do you recommend going about having global audio data references? As a side note, it might be nice to have audio groups be scriptable object data instead. That way it's not string based and would probably be easier to hook up audio events rather than scrolling down the long string list. It would also mean you could modify them outside of the scene / master audio prefab context.
|
|
|
Post by DarkTonic Dev on Dec 2, 2023 3:22:54 GMT
That is the correct way to do it. How many Sound Groups do you have?
There is no ideal way to fix it when you change the name of a Sound Group. However, our RelationsInspector integration will locate all Master Audio included scripts using the Sound Group. But not your custom scripts. Then you can find them, take a note of where they are, change the Sound Group, then go re-select it on those scripts.
The Sound Group list used to be an Enum in the very earliest version of Master Audio, but there was massive pushback against having to recompile every time it changed so we scrapped that concept. However, you could create your own Enum and use that in your publically exposed variable if you like that better.
I'm not really sure what you mean about scriptable object. Perhaps our file under Resources for the preferences is a Scriptable Object? I forget. But I'm not really sure how/if it would work with "all sound groups", especially considering that can be different per Scene.
|
|
|
Post by Nikola on Dec 2, 2023 6:01:17 GMT
Thank you for the quick response! There are 54 fields. Surely there must be a way to not make the editor slow to a crawl if this is the intended away? I tried commenting out some of the find object lookups and allocating the new list every time in the property attribute script and didn't seem to help, so I'm not sure what the issue is. Please let me know if there is any code I can tweak / remove to make it run a bit smoother, it should be pretty simple to reproduce this issue.
All I was suggesting is having the groups be data objects that could be easily hooked up in an inspector field versus the string lookup method. I realize you have it architected a certain way where the data is coupled with the main prefab, but just from a user perpsective it would be nice to have decoupled audio group data for easy hook ups. Having different settings per scene is a fair point since the data would be global, but I'm not sure how common that case is to be honest. I definitely don't think enum is the way to go.
|
|
|
Post by DarkTonic Dev on Dec 2, 2023 6:47:54 GMT
There's probably no way to do it ideally with the restrictions given.
I see, it sounds like the issue is you are using so many fields on a single script. I will have to make a similar script and see if there's a way to optimize it. I will take a look Monday and get back to you.
|
|
|
Post by DarkTonic Dev on Dec 4, 2023 15:01:29 GMT
I've found duplicate lookup code for Dynanmic Sound Group Creators and also initialized the array up front. It should be somewhat faster. But it was showing no performance issues on my computer with 50 Sound Groups and 50 public group fields.
Send me an email or PM me with your Unity Asset Store invoice PDF file asking for the latest.
Thanks.
|
|
|
Post by Nikola on Dec 5, 2023 18:55:14 GMT
I've found duplicate lookup code for Dynanmic Sound Group Creators and also initialized the array up front. It should be somewhat faster. But it was showing no performance issues on my computer with 50 Sound Groups and 50 public group fields. Send me an email or PM me with your Unity Asset Store invoice PDF file asking for the latest. Thanks. Sent you an email with pdf and also video clip of what I'm experiencing
|
|
|
Post by DarkTonic Dev on Dec 5, 2023 19:33:17 GMT
Thank you. I will need to be able to reproduce it on my machine to figure out the cause.
|
|