sr4dev / Unity-SpriteAssist

Unity Sprite mesh extension
https://github.com/sr4dev/Unity-SpriteAssist
227 stars 29 forks source link

Out of Memory Errors on First Project Open #66

Closed konistehrad closed 7 months ago

konistehrad commented 7 months ago

I'm encountering an issue where the editor will run out of memory on first open if SpriteAssist is in the project. Removing SpriteAssist stops memory growth and returns it to normal. This is a tracking issue while I investigate, as we depend on SpriteAssist for large portions of our upcoming game.

sr4dev commented 7 months ago

I'll check it out.

Trying to reproduce the problem isn't easy.

I use SpriteAssist in my game project too, but I haven't heard about any Out of Memory issues yet.

It could be due to how the project is set up or some uncommon thing happening during asset import.

konistehrad commented 7 months ago

Yeah I assumed it was relatively uncommon. For reference we have thousands of traditionally animated frames at 4K that aren’t part of our SpriteAssist pipe but I think SpriteAssist is still seeing and processing them. I’ll continue to investigate and thanks again for your hard work on this awesome project.

sr4dev commented 7 months ago

I'm not sure about the cause of the issue, but adding a 'feature to exclude textures from a specific path' in SpriteAssist might be helpful.

I'll try adding this feature. However, I'm not sure when I can start the work.

konistehrad commented 7 months ago

I can try adding the feature if you’re taking PRs. 😊 It would really help me too and I would like to contribute to this project.

sr4dev commented 7 months ago

Sure, thank you so much!!!

To be honest, I must say that this open-source project doesn't have great code. So, adding new features might be challenging. If you can wait, it might be possible to add the features around late February or early March.

konistehrad commented 7 months ago

No worries I can already see a very clear path to making this change. (ScriptableSingleton is new to me and very useful!) Would you prefer the path matching to be globs, or Asset references to directories?

sr4dev commented 7 months ago

I prefer the path matching to be using globs.☺️

konistehrad commented 7 months ago

I don't want to add a dependency, so I'm going to implement globbing using simple regex expansion. I don't want to add Microsoft.Extensions.FileSystemGlobbing for example. I'll open a draft PR soon with the proposed changes. Thanks again!

sr4dev commented 7 months ago

I don't want to add a dependency, so I'm going to implement globbing using simple regex expansion.

Thank you!☺️

konistehrad commented 7 months ago

Draft PR up and ready for review. Found a neat little bug while I was in there that I plucked into its own PR for review and merge. Thanks again!

sr4dev commented 7 months ago

I've merged all the PRs and released v.1.2.0! https://github.com/sr4dev/Unity-SpriteAssist/releases/tag/v1.2.0

It may take a few minutes for v1.2.0 to be reflected on OpenUPM.

Thanks to your PR, the import speed and efficiency of my game project seem to have significantly improved. Your efforts are truly appreciated! Thank you!

konistehrad commented 7 months ago

My pleasure. And thank you, again, for your hard work on this project!