Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Editor callbacks can't get unregistered, so some methods that re-add themselves accumulate callbacks #185

Open
hymerman opened this issue Nov 8, 2016 · 0 comments

Comments

@hymerman
Copy link
Contributor

hymerman commented Nov 8, 2016

I'm finding that FullInspector slows my game down gradually, because it's building up a huge number of callbacks. Anything that uses fiLateBindings.EditorApplication.RemUpdateFunc and AddUpdateFunc suffers from this, and there are some parts of FullInspector that add an update function every 0.3 seconds.

It looks like taking a copy of the Action in fiLateBindingsBinder, instead of storing it as an actual UnityEditor.EditorApplication.CallbackFunction prevents Unity recognising and removing the callbacks - it must be doing an object equality check.

Changing the code to not make a copy fixes this - but means that Unity editor types are exposed in non-editor code, meaning any calls to fiLateBindings.EditorApplication.RemUpdateFunc have to be guarded with #if UNITY_EDITOR. I'll submit a PR shortly; perhaps you can think of a better fix though!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant