-
-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change the call for OnReloadEditor to be called from AssetPostprocessor.OnPostProcessAllAssets method instead of [InitializeOnLoadMethod] #342
Comments
When is this code actually supposed to be run? The docs on This If this is intended to only happen on project load, then If this code is supposed to only be called on project launch, then I think there isn't really a correct Unity hook for that, at least not on the code side. I think the only solution for that is using Unity's project settings. The reason I bring this up is that this code is EXTREMELY slow on full production sized projects that have a good number of SOs referenced by node graphs, at least when Visual Studio's debugger is attached. See the ticket I filed for that: #351 - I think that whatever solution there is, it should address this problem as well. Would be good to know what the code is even trying to solve. |
Here's a potential implementation:
This implementation will get called all the time when assets get edited, but the extra filtering at the top level should help reduce performance drain. I can make a PR for this if it makes sense, but want some feedback on this approach before I go ahead. In my project I've added a menu item to do the full scan and rebuild like the old code did, and a unit test that detects if any of the changes that would be made are required (which only adds about 0.5s to the unit test runtime). I'm not sure if they're necessary with the above code in place, but I'm trying to be extra cautious in our project and not break this library's behavior. |
change the call for OnReloadEditor in NodeEditorAssetModProcessor class to be called from AssetPostprocessor.OnPostProcessAllAssets method instead of [InitializeOnLoadMethod]
going by the documentation of Unity, its not correct to load assets in methods that were invoked by InitializeOnLoadMethod:
https://docs.unity3d.com/ScriptReference/InitializeOnLoadAttribute.html
The text was updated successfully, but these errors were encountered: