|
Post by onemoofortwo on Jun 12, 2024 10:56:42 GMT
Hi, First off, just wanted to say I've been using Master Audio for a few years now, and have loved using the asset! I'm using an old version of MasterAudio (2020.3.8), so I appreciate that this bug may have been fixed in the newer versions, but I thought it was worth reporting just in case. Recently, I ran into a bug when selecting multiple ScriptableObject assets, with fields using the [SoundGroup] attribute - If you shift-select them all, all of their values are overridden to the value of the most recently selected ScriptableObject. I can't fit an example project into the 1MB limit of the attachments, but I've attached screenshots of the issue, and this is the code that I'm able to reproduce this with. ![]() [CreateAssetMenu(fileName = "ScriptableObjectTest", menuName = "Test/TestScriptableObject")] public class ScriptableObjectTest : ScriptableObject { [field: SerializeField, SoundGroup] public string TestSFX { get; private set; } }
|
|
|
Post by DarkTonic Dev on Jun 12, 2024 22:30:46 GMT
Hi, glad you're enjoying it. I don't use Scriptable Objects, so I don't understand or know how to test this.
Did you want to upgrade to the newest product? That way I can more easily try and replicate it and fix it.
Either way, if you give me steps to reproduce I will take a look. Not sure I will know how to fix it though.
Thanks, Brian
|
|
|
Post by onemoofortwo on Jun 13, 2024 7:53:15 GMT
Unfortunately I don't have access to the newest version of the Asset, but I can give the steps to recreate the issue. 1. Create a scene with the MasterAudio prefab in it, and create 3 unique Sound Groups. 2. Create a Script like the one I posted above, inheriting from ScriptableObject, with variable using a [SoundGroup] Attribute, and a CreateAssetMenu attribute so you can create assets of the object. 3. Via the context menu in the project explorer (in the example code, Right Click > Test > TestScriptableObject) create 3 assets of the ScriptableObject. 4. Select each asset individually, and assign each a different one of the Sound Groups. 5. Observe that they are all correctly storing their own individual Sound Group. 6. Select all of the ScriptableObject assets at once, then deselect. 7. Observe that all of the individual assets' Sound Groups have now been set to the group of the most recently selected one. If it's any help, I believe I have fixed this locally in the project this is being used in by adding this to the beginning of the OnGUI method of SoundGroupPropertyDrawer.cs: public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { //Disable Multi Object Editing - Values were being overridden by most recently selected objects if (property.serializedObject.isEditingMultipleObjects) { EditorGUI.BeginDisabledGroup(true); EditorGUI.LabelField(position, label.text, "Cannot Multi-Edit Sound Groups"); EditorGUI.EndDisabledGroup(); return; }
//The rest of the OnGUIMethod... } Attachments:![](//storage.proboards.com/5595162/thumbnailer/uKYy0uZfbCXcHJSNwrDc.png)
|
|
|
Post by DarkTonic Dev on Jun 13, 2024 18:02:56 GMT
Thanks.
I tried in Unity 2019 and was unable to reproduce the bug. When I selected all 3, then went back and looked at each of them, they were still different. I was using Unity 2019.4.40f1. If I select a new Sound Group while they are multi-selected, they do all change, but that is expected.
|
|