mcpiroman / UnityNativeTool

Allows to unload native plugins in Unity3d editor
MIT License
183 stars 18 forks source link

Add keyboard shortcuts to LoadAll, UnloadAll #10

Closed rogerbarton closed 4 years ago

rogerbarton commented 4 years ago

Works shortcut manager in Unity 2019.1+ Older versions work with MenuItemAttribute

mcpiroman commented 4 years ago

Well, sure. Is [Shortcut] attribute somehow superior to [MenuItem]? Because if it's the same thing but newer, I think it'd be better to just stick with the letter, not to double things unnecessarily. And as a nit, I'd prefer if these attributes were in the DllManipulatorScript, because is's meant to be the 'front end' for user. They may just simply forward calls to DllManipulator.

rogerbarton commented 4 years ago

Yes [Shortcut] exists since 2019.1 allows you to use the shortcut manager UI to customize the shortcut etc. These settings are stored between projects (as an EditorPref I believe) so you only set them once.

I will move them to the DllManipulatorScript ...

mcpiroman commented 4 years ago

Well, since you also use UnityEditor namespace here (which I didn't notice previously, my bad) this should also go somewhere inside Editor folder. I think you can just simply copy this to DllManipulatorEditor file and it'd be fine.

rogerbarton commented 4 years ago

That's a good point, I've moved it now.

mcpiroman commented 4 years ago

Oh and you should also add the relevant namespace for [MenuItem] too, because they aren't in UnityEditor.ShortcutManagement

rogerbarton commented 4 years ago

That's a valid point, however its in UnityEditor. But I realized I forgot the macro in the using part, which I've now added.

mcpiroman commented 4 years ago

Looks fine, thanks!

rogerbarton commented 4 years ago

Thanks for creating this tool!

mcpiroman commented 4 years ago

Well, I just pulled your branch to see the changes (forgetting that I already merged this PR) , and I see some additional repainting stuff going on. Is that something that could matter?

rogerbarton commented 4 years ago

That commit "Repaint editor GUIs on shortcut" has not been merged yet.

Basically I wanted to repaint when the shortcut is triggered. However, I believe that there is still a better implementation (with actions/events) that catches all the points when a repaint is needed. So its still work in progress.