Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

SpriteSharp - Sprite Mesh Optimizer

Discussion in 'Assets and Asset Store' started by ZimM, May 24, 2015.

  1. deemen

    deemen

    Joined:
    Dec 29, 2013
    Posts:
    17
    @ZimM: SpriteSharp currently isn't playing nice with the Unity Package Manager. When loading a project for the first time with packages being included, your texture pre-processor is trying to modify and re-import assets that are in packages. These assets are read-only and can't be modified so Unity enters an infinite loop and continues trying to reload the asset in a loop. We fixed this on one of our own texture pre-processors by adding a check that the path contained "Assets" at the start.

    Also, the sprite atlas hack changes the userData field but it would be nice if it didn't stomp what was already in there as we use it for something else.
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    TBH I would say it's PM not playing nice with everything else. PM causes huge lag entering playmode and does a bunch of stuff it really shouldn't be doing atm.
     
  3. deemen

    deemen

    Joined:
    Dec 29, 2013
    Posts:
    17
    Yeah I don't disagree.
     
  4. HoneyButterAlmond

    HoneyButterAlmond

    Joined:
    Oct 27, 2016
    Posts:
    4
    SpriteSharp v2.5.0
    Unity 2019.1.3f1

    'Use Default Override Settings' is not working when add new sprite asset.
    It only worked with 'reimport'.

    The problem is SpriteImportManager.ProcessSingleSprite
    TextureImporter textureImporter = texture.GetTextureImporter();

    textureImporter is always null.

    So, I added next code to SpriteImportPostProcessorImpl.OnPostprocessSprites
    and using as parameter.
    TextureImporter textureImporter = (TextureImporter) postprocessor.assetImporter;
     
    Last edited: Jun 12, 2019
  5. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    76
    SpriteSharp 2.5.1.0 not working with Unity 2019.3.0b3
     
  6. piotrlipert

    piotrlipert

    Joined:
    Jun 23, 2015
    Posts:
    4
    Bumping up TimNedvyga, SpriteSharp not working with Unity 2019.3.0b3

    Code (CSharp):
    1.  
    2. System.NullReferenceException: Object reference not set to an instance of an object
    3.   at LostPolygon.SpriteSharp.Utility.BuildPlatformsUtility..cctor () [0x001cb] in <48b0d871d4244170b9e4ba7f4e597991>:0
    4. 0x00007FF6B0B135EC (Unity) StackWalker::GetCurrentCallstack
    5. 0x00007FF6B0B16A51 (Unity) StackWalker::ShowCallstack
    6. 0x00007FF6AF28D555 (Unity) GetStacktrace
    7. 0x00007FF6B179F390 (Unity) DebugStringToFile
    8. 0x00007FF6B0B7A825 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    9. 0x000001A4ACD3817B (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    10. 0x000001A4ACD37D8B (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    11. 0x000001A4ACD2908E (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
    12. 0x000001A4ACD2865A (Mono JIT Code) UnityEngine.Debug:LogError (object)
    13. 0x000001A4ACCFC1A3 (Mono JIT Code) UnityEditor.EditorAssemblies:processInitializeOnLoadAttributes (System.Type[])
    14. 0x000001A4C27ED3EB (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_object (object,intptr,intptr,intptr)
    15. 0x00007FF85C23C8B0 (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
    16. 0x00007FF85C1C1DA2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke
    17. 0x00007FF85C1CAD9F (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke
    18. 0x00007FF6B0A9556E (Unity) scripting_method_invoke
    19. 0x00007FF6B0A8F24D (Unity) ScriptingInvocation::Invoke
    20. 0x00007FF6B0A89225 (Unity) ScriptingInvocation::Invoke<void>
    21. 0x00007FF6ADEFF9F5 (Unity) Scripting::UnityEditor::EditorAssembliesProxy::processInitializeOnLoadAttributes
    22. 0x00007FF6B0A62883 (Unity) MonoManager::SetupLoadedEditorAssemblies
    23. 0x00007FF6B0A5A664 (Unity) MonoManager::EndReloadAssembly
    24. 0x00007FF6B0A60DB7 (Unity) MonoManager::ReloadAssembly
    25. 0x00007FF6AEF18823 (Unity) ReloadAllUsedAssemblies
    26. 0x00007FF6AEEF6B90 (Unity) EditorSceneManager::RestoreSceneBackups
    27. 0x00007FF6AE96DC54 (Unity) PlayerLoopController::EnterPlayMode
    28. 0x00007FF6AE97FC94 (Unity) PlayerLoopController::SetIsPlaying
    29. 0x00007FF6AE982B1F (Unity) Application::TickTimer
    30. 0x00007FF6AF2B3CF0 (Unity) MainMessageLoop
    31. 0x00007FF6AF2BD9FA (Unity) WinMain
    32. 0x00007FF6B223F922 (Unity) __scrt_common_main_seh
    33. 0x00007FF8B8194034 (KERNEL32) BaseThreadInitThunk
    34. 0x00007FF8B87D3691 (ntdll) RtlUserThreadStart
     
  7. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    76
    @ZimM Hey, any news about 2019.3 update? Or you are waiting for stable release?
     
    flankey and NeatWolf like this.
  8. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    203
    The author does not seem to be active on all visible communication channel since last year. Fortunately he included the source files in the package.
     
  9. HoneyButterAlmond

    HoneyButterAlmond

    Joined:
    Oct 27, 2016
    Posts:
    4
    I fixed a bug. Use Asset Pipeline v1(legacy) and edit source code null exception.
    Here is screenshot. sprite_sharp.JPG
     
  10. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    76
    How did you deal with null exception?
     
  11. HoneyButterAlmond

    HoneyButterAlmond

    Joined:
    Oct 27, 2016
    Posts:
    4
    @TimNedvyga Edit 'BuildPlatformsUtility.cs' like this. It's just simple reflection.
    edit.JPG
     
    cwennchen, Zeitcatcher and TimNedvyga like this.
  12. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    76
    Nice, it works :)
    It remains to find a fix for Asset Pipeline v2
     
  13. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    20
    May I ask where do you find the BuildPlatformsUtility.cs? I am unable to locate it within my project files
     
  14. Seromu

    Seromu

    Joined:
    Nov 30, 2015
    Posts:
    4
    1. Remove DLL
    SpriteSharp/Editor/LostPolygon.SpriteSharp.dll

    2. Import Unity Package
    SpriteSharp/SpriteSharpSource.unitypackage

    3. Find 'BuildPlatformsUtility' in Project Window
     
  15. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    20
    Ahh Thank you!
     
  16. Gregoire_Seguin

    Gregoire_Seguin

    Joined:
    Oct 8, 2018
    Posts:
    2
    SpriteSharp 2.5.1.0
    Unity 2018.4.14f1

    Hey,
    I recently bought the SpriteSharp tools, and it works as fine, generating sprite and exporting them it's perfect. Thanks a lot for the Dev and the community for improving the tools.
    But in the console, I have some errors (and I'm not a programmer, either tech artist), I tried the answer of everyone heres, but still had errors.
    If you have a suggestion, I'm here ;)
     
  17. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    565
    Guys, i think Zim has abandoned this asset. The last time he was online was in Oct 28, 2019

    I used this asset and it was great, but now Unity has a build in Tool that accomplishes overdraw reduction on sprites and since some time these sprites can even be used on UI-objects, hurray!

    sprite.gif
     
  18. Gregoire_Seguin

    Gregoire_Seguin

    Joined:
    Oct 8, 2018
    Posts:
    2
    SpriteSharp is very usefull, and Unity can't create sprite with this kind of details. Here for exemple, you can create a sprite with Opaque surface and keep the sprites border in Alpha. And one more thing, you can export the generate sprites mesh into a seprate mesh and material.
     
  19. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    565
    Then i am wrong! Where is ZimM? We need Updates :D
     
    Gregoire_Seguin likes this.
  20. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    326
    Just picked this up from the Asset Store, unfortunate to see that the dev is MIA. Hopefully will return and support it.... Thanks to those with tips on how to hack it for now.
     
  21. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    76
    I got in touch with him on Facebook. He said that the update is coming. So cross your fingers, guys :)
     
    Glaswyll and rxmarccall like this.
  22. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    20
    Awesome! Can't wait for the update to arrive! :)
     
  23. MacroPinch

    MacroPinch

    Joined:
    Dec 6, 2013
    Posts:
    40
    Did he provide any update when he is expecting to update it?
     
  24. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    76
    Nah, I no longer heard from him since then :(
     
  25. MacroPinch

    MacroPinch

    Joined:
    Dec 6, 2013
    Posts:
    40
    I tried fixing the bug myself, but the behavior of the asset database APIs has changed in AssetDatabase v2 in a way that's incompatible with the plugin's internals. I've asked, whether the new behavior of the APIs is intended or it might be a bug, but nobody from unity has answered yet. There's no information in the API docs. Here's the thread:

    https://forum.unity.com/threads/ass...n-results-during-onpostprocesssprites.879541/
     
  26. Seromu

    Seromu

    Joined:
    Nov 30, 2015
    Posts:
    4
    upload_2020-6-23_21-38-3.png

    ZimM was last seen: Jun 15, 2020...
     
unityunity