NaughtyAttributes icon indicating copy to clipboard operation
NaughtyAttributes copied to clipboard

Add an AdvancedDropdown based attribute

Open krisrok opened this issue 3 years ago • 4 comments

Adds an attribute and drawer around Unity's AdvancedDropdown class. Code is based on the existing Dropdown and can be used with IDropdownList.

krisrok avatar Sep 01 '20 10:09 krisrok

I added some info and an image in the readme and tried to keep it in sync with the other stuff in the readme. Feel free to shorten the example as it is a bit long.

The oldest version I tested on was 2018.4.x but I expect it to work on 2018.3 as well. Just fyi as you have 2018.3 in your specs.

krisrok avatar Sep 01 '20 10:09 krisrok

Nice one! Found an issue though, although it may be Unity's (I'm using 2022.1.0b12.2880, reproduced in 2022.1.0b16 too). Asset isn't marked as Dirty, so I added EditorUtility.SetDirty(property.serializedObject.targetObject); after ApplyModifiedProperties and it fixed the issue.

RunninglVlan avatar Apr 19 '22 15:04 RunninglVlan

Strange, SetDirty should not be neccessary in this case.

I've tested the DemoScene with 2020.3 and 2021.3 and changing the value dirties the scene. Selecting the current value in the dropdown again on the other hand does not set the scene dirty. (Your fix would always set it dirty, but that's a minor annoyance I'd say.)

Can you maybe confirm your described behaviour with the DemoScene in your 2022.x installations? Maybe it just does not work with your current class, mabye due to Unity's serialization?

krisrok avatar Apr 20 '22 11:04 krisrok

As far as I remember, it worked for me too in Scene and Prefabs (when they are opened), but it doesn't for ScriptableObjects and if Prefabs are not opened Oh yeah, and the same behavior is with simple DropdownAttribute

RunninglVlan avatar Apr 20 '22 11:04 RunninglVlan