Search Unity

An Update on Substance Format Support in Unity

Discussion in 'Formats & External Tools' started by ans_unity, Dec 19, 2017.

  1. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    I understand. Thanks for the explanation.
     
  2. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    So, in one week since upgrading from 2017, this plugin is very unstable and we are experiencing regular editor crashes as a result of substance. This is with a mere five materials from substance source used in the project. We have now exported TGAs and removed them.

    Selecting substances in the editor window regularly crashes the project.

    Returning from Playmode regularly hangs Unity for extended periods of time. Restarting Unity if the hang is unusually long (>1min, which should be more than enough for 5 1k-sq substances, which shouldn't be re-baked anyway) to say "A default asset was created for foo.sbsar because the importer crashed on it last time."

    Viewing thumbnails of substance assets in the project browser regularly returns black, although they render correctly in the preview window.

    On-device behaviour is fine, but if you want runtime baking there doesn't actually seem to be any anymore.

    I'd caution anyone updating to 2018 that substance is unstable enough that you probably want to export TGAs from Substances outside of Unity.
     
  3. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    When I go into play mode my Substances disappear, and I get these:

    AssetImporter is referencing an asset from the previous import. This should not happen.
    UnityEditor.AssetDatabase:ImportAsset(String)
    Substance.Editor.EntryPoint:StateChange(PlayModeStateChange)
    UnityEditor.EditorApplication:Internal_PlayModeStateChanged(PlayModeStateChange)

    and

    NullReferenceException
    UnityEngine.Object.get_name () (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:198)
    Substance.Editor.SubstanceImporter+<>c__DisplayClass61_1.<OnImportAsset>b__1 (UnityEngine.Texture2D item)
    System.Collections.Generic.List`1[UnityEngine.Texture2D].GetIndex (Int32 startIndex, Int32 count, System.Predicate`1 match) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:313)
    System.Collections.Generic.List`1[UnityEngine.Texture2D].Find (System.Predicate`1 match) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:216)
    Substance.Editor.SubstanceImporter+<>c__DisplayClass61_0.<OnImportAsset>b__0 (UInt32 pOutputHash, Int32 pFormat, Int32 pChannelsOrder, Int32 pWidth, Int32 pHeight, Int32 pMipCount, IntPtr pPixels, Int32 pPixelLength)
    Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx)
    UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)
    UnityEditor.AssetDatabase:ImportAsset(String)
    Substance.Editor.EntryPoint:StateChange(PlayModeStateChange)
    UnityEditor.EditorApplication:Internal_PlayModeStateChanged(PlayModeStateChange)


    I have to re-import every time after testing play mode. Very strange.
     
  4. Deleted User

    Deleted User

    Guest

    I'm very sorry for these issues you are experiencing. We are working on a new 2.3 release which is going to be released end of March. This 2.3 build drastically improves the update of substances. We have also sped up the time to come out of play mode for Substances. If you are interested in testing this build, please let me know. We are currently in private beta with 2.3.

    Cheers,
    Wes
     
  5. Deleted User

    Deleted User

    Guest

    Hi,

    Would you be able to contact us with a project file? I talked to our dev team and it would be great if we could take a look at the project. You can contact me at wes.mcdermott@allegorithmic.com.

    Cheers,
    Wes
     
    Deckard_89 likes this.
  6. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Thanks Wes. We'll wait for the official release.

    A significant problem seems to be that when iterating with your editor platform set to iOS, re-compressing PVRTC textures takes a long time. Working on a copy of the project with editor platform set to Windows or Mac makes the process much more efficient and the plugin feels better.

    I'm not 100% sure, but I think that previously the Unity Editor was not PVRTC-ing generated textures for every substance tweak (including those cases where substance seems to think something has changed when exiting playmode, not sure if this is because we didn't instantiate a material and runtime code made a tiny change to it, thus making the asset dirty.)

    Anyway, the take-away is that currently the plugin is far more stable if not using ios as your editor platform. You can turn compression OFF on the substance properties when iterating, but then our build won't fit on device until you turn it back on.

    Can you confirm that this behaviour is different from previously (e.g. that previously textures were baked to PVRTC as part of the ios build process?) We would happily have the editor not identically match ios runtime (e.g. it doesn't show PVRTC compression artefacts, which when working with 1k/2k-square maps are rarely an issue) in exchange for stable iteration in editor whilst still using the iOS target platform.
     
    syscrusher and Deleted User like this.
  7. Deleted User

    Deleted User

    Guest

    Thanks very much for this feedback. I talked to our dev team about this and we have some ideas on ways to improve this. I have logged this feedback as a user story for us to address.

    Cheers,
    Wes
     
  8. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Sorry, I should have posted. After restarting my system (after a Windows update), the problems with Substance were solved and they now work correctly - no errors, no disappearances. I doubt it was actually related to the OS needing an update, but stranger things have happened I suppose.

    Anyway, all good over here :)
     
    syscrusher likes this.
  9. RichardCulver

    RichardCulver

    Joined:
    Nov 19, 2013
    Posts:
    6
    I have not had time to read the entire thread. But I was looking for a way to proceedurally generate a material. And if I understood this right, the old 2017 version allowed this. Whereas the new Substance Plugin, while "live" in the editor applies the changes to the maps. Maybe I don't have this 100% correct.

    But what I want is a "true" procedural texture that remains live and that I can map to other co-ordinates than a fixed UV space as you would with a 2D image map. For example projected out from object space or even world space. So it could be a tile image even that is generated on the fly to map itself to other spaces than UV.

    I know we can do this in Substance Painter, for example. But the result of that gets baked down to an image and exported in this state.

    I am curious if, in game play, it is possible to map procedural (mathematical node network) to the surface of geometry. So that when, for example, the mesh is stretched, the procedural texture does not reflect in stretching the image due to being locked to a UV space.

    There is a very specific use case I have within the medical simulation field.

    Thanks!
     
  10. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I've installed the plugin into 2017.4 and still get this error?:

    Assets/T4M/Editor/T4MSC.cs(227,2): warning CS0618: `UnityEngine.ProceduralMaterial' is obsolete: `Built-in support for Substance Designer materials has been deprecated and will be removed in Unity 2018.1. To continue using Substance Designer materials in Unity 2018.1, you will need to install Allegorithmic's external importer from the Asset Store.'

    How do I get rid of these warnings?
     
  11. Deleted User

    Deleted User

    Guest

    For 2017.4, you don't need to install the plugin. The Substance plugin was natively integrated in Unity 2017. It was removed from the engine in Unity 2018.

    Cheers,
    Wes
     
  12. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    @wesm - Any update on this plugin getting out of beta? Back in February it was thought that it might be ready in April.
     
    Mullan7 and EnriquePage91 like this.
  13. Deleted User

    Deleted User

    Guest

    Hi,

    Yes! I wanted to post more info earlier but needed to wait to make sure the schedule was going to be correct. We had a delay when we found a crash for our 2.3 update. We seeded the latest build to our beta. We are looking at delivering 2.3.2 very soon to the asset store. This build addresses major issues we've had with upgrading projects as well as other bug fixes and overall improvements.

    If you are interested in joining our beta, please let me know and I can give you or anyone who is interested access. Please join our Allegorithmic Discord and send me a PM with your username.
    https://discordapp.com/invite/010JCPblJTh3d6CXe

    We are also already been working on our 2.4 release as well so the next major update will not be delayed. This update will have several features I will be able to discuss soon. However, our big feature support will be HDRP.

    Cheers,
    Wes
     
  14. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    @wesm - Great news! Thanks! I had the feeling something was on the way. :)

    There's a Procedural Planets kit that I've been interested in for quite a while, but it uses Substance in a more advanced way, and it hasn't worked with past versions of the Substance plugin.

    Any idea if it will work with this upcoming version?
     
  15. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    As the new external substance plugin doesn't really work that nicely (sometimes destroys prefabs, nullrefs etc), i wanted to suggest/request making it an 'official' plugin again by offering it through the package manager, developed in collaboration with unity. The previous integration worked so well, it is needed/much wanted to have it work like that again.
     
  16. Nicate

    Nicate

    Joined:
    Jul 18, 2018
    Posts:
    16
    I have an issue in 2.3.0 that I did not have in 2.2.0. The "Generate All Outputs" textures now appear to be upside down.
     
  17. Nicate

    Nicate

    Joined:
    Jul 18, 2018
    Posts:
    16
    Scratch that, it looks like they have always been upside down, or at least during 2.2.0 too. I just never noticed because I was using rather noisy textures before. This explains some things.
     
  18. Deleted User

    Deleted User

    Guest

    Hi,

    Thanks for letting us know this issue. I can confirm this as well. We will get this fixed ASAP.

    Cheers,
    Wes
     
    Last edited by a moderator: May 21, 2019
  19. Deleted User

    Deleted User

    Guest

    Hey Everyone,

    Just wanted to check to see if anyone is having issues with prefabs when updating the plugin. We are getting some reports of prefabs or scenes breaking but it seems to happen on complex projects. If anyone is experiencing this and would like to participate in our private beta, please let me know.

    Cheers,
    Wes
     
  20. Nicate

    Nicate

    Joined:
    Jul 18, 2018
    Posts:
    16
    I've been having no update problems since the introduction of 2.2.0. I did have update problems before 2.2.0, but I reported these two or three pages back and they were fixed. Perhaps they are updating from before 2.2.0? My projects however are not very complex. I do get a "material property something something < 2.3.0" warning, but nothing seems out of the ordinary.

    I'll be working with Unity quite a bit for the coming months, so maybe I can help out in the private beta. They are generally low complexity projects though. I do use custom shaders a lot.
     
  21. Deleted User

    Deleted User

    Guest

    We would greatly appreciate your help in our beta. Can you join our discord group?
    https://discordapp.com/invite/010JCPblJTh3d6CXe. You can then send me a message. My id is Wes McDermott and I will add you to the group.

    Cheers,
    Wes
     
  22. Milanis

    Milanis

    Joined:
    Apr 6, 2018
    Posts:
    55
    So, I wondered if i should give Substance a try in Unity 2019.1.2f1. Installed the plugin (backup before) and..fluff.. first there was some websocket error for substance. After reloading Unity, out of nowhere Textmeshpro stopped working and the package manager vanished. I am seriously not sure what your coders are doing. Anyways, I would love to use substance for our project. I've seen that Ubisoft is having an Substance > PSD > Engine workflow. Are there any more informations out in the wild regarding this workflow?
     
  23. Milanis

    Milanis

    Joined:
    Apr 6, 2018
    Posts:
    55
    Okey little update: Seems like Substance Plugin is working fine on an entirely new project. Going to test what happens if I add my old project into it now.
     
  24. Deleted User

    Deleted User

    Guest

    Please let us know what happens. Also, we can add you to our private plugin beta. We are needing feedback with users who have complex projects so we can find issues with prefabs or conflicts with other packages.

    Cheers,
    Wes
     
    Milanis and JBR-games like this.
  25. Milanis

    Milanis

    Joined:
    Apr 6, 2018
    Posts:
    55
    Of course, I already joined the Discord for Substance. Happy to help, up to you where the feedback should happen best.
     
    hopeful likes this.
  26. Deleted User

    Deleted User

    Guest

    Awesome! Thank you very much. I have added you to the Unity beta group on discord.

    Cheers,
    Wes
     
  27. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Currently trying out some stuff in the 2019 Alpha with HDRP. The following happens.

    Black material after Play Mode:
    1) Import a new substance into Unity or modify an existing one
    2) Enter Play Mode
    3) Exit Play Mode

    After leaving play mode in the editor, the material that uses substance textures turns completely black until you modify the substance again or select one of its output textures in the Project folder to make it regenerate its outputs.

    This does not happen when (after starting up Unity) no changes are made to already existing substances. In that case exiting Play Mode has no negative effect.

    Unity 2019.3.0a4
    Substance in Unity 2.3.2

    Also when starting up the project this error appears although the plugin is installed:
    Assets/Substances/Blockout_Tiles_01.sbsar: Built-in support for Substance Designer materials has been removed from Unity. To continue using Substance Designer materials, you will need to install Allegorithmic's external importer from the Asset Store.
     
    Last edited: Jun 8, 2019
  28. Deleted User

    Deleted User

    Guest

    Hi,

    Thanks for posting this issue. I have filed this as a ticket and our team is looking into this now.

    Cheers,
    Wes
     
    JBR-games likes this.
  29. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Yet another error.
    I created a second sbsar with 3 graphs in it. Two graphs were meant to be used as actual textures. The third was just a generator to create rocks and hide the complexity of their generation nodes.
    After importing this substance into Unity 2019.3.0a4 the editor complained about that generator graph being used in multiple places and not being able to guarantee its uniqueness - whatever that means. The complete error message is lost - I'm trying to remember here what happened yesterday.
    After fiddling around with that graph and entering and exiting play mode I noticed that my older terrain material did not link to the textures of my first imported sbsar anymore.
    And to top that my second imported sbsar (with the 3 subgraphs) was now in an unreadable state in the editor - Unity had no clue how to interpret that asset. I closed Unity. I restarted Unity. Instant crash. Unity closed.
    After deleting the second sbsar and its meta file from the project via Windows Explorer I restarted Unity successfully.

    So in a nutshell: the plugin is quite unstable in this Alpha version of Unity and seems to require a specific setup of the sbsar - otherwise asset import problems occur, delinking of textures occurs... and maybe worse stuff.
     
    syscrusher likes this.
  30. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    A question regarding terrain and normal maps of imported substances:
    The HDRP terrain material asserts that the normal map is not in the correct format and must be of import type "normal map". Isn't the plugin supposed to be doing that already? Can I do this myself somewhere?

    Edit: btw. thanks for watching/monitoring this thread, Wes
     
    Last edited: Jun 12, 2019
  31. Deleted User

    Deleted User

    Guest

    Hi Marco,

    Thanks for posting these issues. Can you please post the exact errors you are getting in the Unity console window? In order to address this we would need the sbs file. Would you be able to share that with me?

    Also, I can add you to our Unity private beta if you are interested. Please let me know.

    Cheers,
    Wes
     
  32. Deleted User

    Deleted User

    Guest

    Hey Marco,

    In this case, you can still use the normal map. We are not using the Unity dxtnm compression. We have spoken to Unity about this and I think we will be able to offer this compression mode in a user preference. Our normal map is compressed using BC5 which is higher quality, but Unity doesn't recognize it by default.

    Cheers,
    Wes
     
    hopeful likes this.
  33. roxenhall

    roxenhall

    Joined:
    May 9, 2018
    Posts:
    5
    Hey!

    I have upgrade my Unity to ver. 2018.4.2f1 and needed Allegorithmic plugin, but after I import the plugin I get this error:

    Assets\Allegorithmic\Plugins\Substance\Livelink\Editor\Scripts\MeshLinkEditor.cs(21,33): error CS0433: The type 'WebSocket' exists in both 'SmartFox2X, Version=1.7.2.0, Culture=neutral, PublicKeyToken=null' and 'websocket-sharp, Version=1.0.2.29661, Culture=neutral, PublicKeyToken=5660b08a1845a91e'

    How can I go round with this?

    Best Regard

    Roxenhall
     
  34. roxenhall

    roxenhall

    Joined:
    May 9, 2018
    Posts:
    5

    I have now update my SmartFox2X.dll but with same results:

    Assets\Allegorithmic\Plugins\Substance\Livelink\Editor\Scripts\MeshLinkEditor.cs(21,33): error CS0433: The type 'WebSocket' exists in both 'SmartFox2X, Version=1.7.12.0, Culture=neutral, PublicKeyToken=null' and 'websocket-sharp, Version=1.0.2.29661, Culture=neutral, PublicKeyToken=5660b08a1845a91e'

    /Roxenhall
     
  35. Deleted User

    Deleted User

    Guest

    Hi Roxenhall,

    This is a known issue. We have a ticket for this. It has to do with the livelink functionality which we will be removing as there is a new solution coming. Does this affect anything in your project? Can you continue to use the plugin?

    Cheers,
    Wes
     
  36. roxenhall

    roxenhall

    Joined:
    May 9, 2018
    Posts:
    5

    Hey!
    Thanks for your quick answer!

    So good that it is a solution going on with the problem I have. :)
    Will it be fixed until the next update?
    I am developing and building my world right now and so far I have no use of SmartFox2X.dll so I have temporarily removed the plugin so unity works flawlessly, otherwise with SmartFox2X.dll it is not possible to play thanks to red error mark I get.

    Best Regard

    Roxenhall.
     
  37. Deleted User

    Deleted User

    Guest

    No problem at all :)

    We are working on updates to complete rework Live Link. The solution we have now is not good and very basic. I can't give an ETA yet, but this will be resolved in the future and we will have a better solution for live link in general.

    Cheers,
    Wes
     
    roxenhall likes this.
  38. roxenhall

    roxenhall

    Joined:
    May 9, 2018
    Posts:
    5
    Thank you for your time and answer! :)

    Best Regard

    Roxenhall.
     
  39. thylaxene

    thylaxene

    Joined:
    Oct 10, 2005
    Posts:
    716
    Is the Substance Plugin safe to use in a new 2019.2 LWRP project?
     
    JBR-games and f1chris like this.
  40. Deleted User

    Deleted User

    Guest

  41. Deleted User

    Deleted User

    Guest

    Hello Everyone,

    We have updated the Unity plugin on the asset store to version 2.3.4. Please see the release notes here.
    https://docs.substance3d.com/display/integrations/Unity+2.3.4

    Known issues:

    Using the plugin with Unity 2019.2 will produce the following error:

    InspectorSubstanceImporter.OnInspectorGUI must call ApplyRevertGUI to avoid unexpected behavior.
    UnityEditor.Experimental.AssetImporters.AssetImporterEditor:OnDisable()
    Substance.Editor.InspectorSubstanceImporter:OnDisable()

    This error can be cleared and will not affect the functionality of the plugin

    Substance Materials breaking

    Substance materials that contain a custom output with a blank usage will break on import. Also, Substance materials containing duplicate usages will break.
    Older sbsar files from GameTextures.com are not currently compatible with the Substance in Unity plugin. These materials which contain unsupported Usage outputs are breaking. Before using the plugin, be sure to make a backup of your project.
     
    syscrusher and Flavelius like this.
  42. conedog

    conedog

    Joined:
    Jul 12, 2010
    Posts:
    50
    Thanks for the update.

    Any update on when il2cpp scripting will work on android?
     
  43. Nicate

    Nicate

    Joined:
    Jul 18, 2018
    Posts:
    16
    I'm so sorry Wes, I picked up some work pretty soon after that and completely forgot about this. Unfortunately I'm not expecting to use Unity again very soon, currently up to my armpits in web tech.
     
  44. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Hi, all sbsar materials are pink and I get this error
    Assembly 'Assets/Allegorithmic/Plugins/Substance/Substance Engine/Editor/Substance.Editor.dll' will not be loaded due to errors:
    Unable to resolve reference 'Substance.Reflection'. Is the assembly missing or incompatible with the current platform?
    Reference validation can be disabled in the Plugin Inspector.

    I'm running Unity 2019.1.9 on Windows.
     
  45. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    SOLVED: I have self-resolved this question. Having two material graphs in one SBSAR was not the problem; rather, it was the issue of duplicated usage tags for outputs within a single graph. I'm leaving the post here (but marking solved) in case anyone else has the same question.

    Good morning, @wesm! I have just resumed using the Substance plugin for Unity after having been away for a while (due to my workload being almost 100% programming lately, nothing related to Substance per se).

    I made two new materials in the latest version of Substance Designer yesterday and imported them into Unity 2019.2.3,, after having installed the current version of the plugin from the Asset Store (2.3.4, iirc).

    Things worked correctly initially, except for the one OnInspectorGUI() error that is documented as a known, and harmless, issue. However, when I tried to edit the Substance Graph properties in Unity, I got some fatal errors and the .sbsar file's icon changed to reflect that Unity no longer associated it with the Substance plugin. Sometimes reimporting it in place fixed the issue, sometimes I had to delete it and reimport from scratch (which was okay as it wasn't yet on any scene objects).

    After some re-reading of the documentation, I believe my issue may have been the known problem with duplicate output usages, and herein lies my question for you. I've worked around the problem, but I want to better understand the situation so I can determine if I've just worked around a known bug, or if I've found a new one that I should report to the dev team.

    My .sbsar file was a single package containing two material graphs, let's call them A and B. The output of A is a single PBR material in its own right, but it is also an input to graph B which uses it as a background and overlays its own content in the foreground.

    The outputs from A and B are each a material master node connected to the usual set of output nodes. The usages of these outputs are of course duplicated between graph A and B, but not within either single graph. Also, I configured B to expose most of the inputs from B's instance of the A material as a settings group for B, so the environment designers could have control over the background as well as the foreground when using B. A couple of A's parameters are hardwired in B because B needs them a certain way.

    When I started having the errors, my first thought after re-reading the plugin 2.3.4 Release Notes was that this is what you meant by duplicate output usages. So I broke off A as a separate package, published it to its own .sbsar file, and imported it into Unity. No problems; it worked as intended.

    Back in Substance Designer, I copied all the generating parts of A onto graph B, but without A having its own output nodes -- in other words, I embedded A into graph B without exposing it as a standalone material. I published this new .sbsar, and again it worked in Unity.

    But while I was merging A into B for this last step, I happened to notice that B had a custom output node called "smoothness" that was a simple inversion of "roughness." I had made that special output originally because I had planned to export the bitmaps to Unity rather than trying the beta plugin, and I was going to use GIMP to merge that smoothness map into the alpha channel of the metallic map. Since the plugin takes care of the channel packing (or obviates it internally...either way, no longer an issue), I deleted that custom output. Since Designer's list of "usage" types doesn't include "smoothness", I had marked it as "glossiness", and there was already a "glossiness" output.

    I apologize for the long-winded explanation, but I wanted to make sure you have all the data. My question is, which of these two things fixed the known issue with duplicate usage? And very specifically, does the current version of the Substance plugin for Unity support having a single Substance package with more than one output material, as long as they are on separate graphs?

    I've been, and remain, a big fan of Substance technology and tools. I absolutely adore what Allegorithmic has brought to the creative workplace. Within that context, though, the constructive feedback I'd like to offer is that I think the Unity plugin would benefit from some additional "defensive coding" to more gracefully handle problems when they occur. I was seeing transient errors about array indices out of range and null object references, which suggests that the programmers need some conditional logic or try...catch blocks around code that relies on externally-supplied data.

    Our project is too large for me to send it to you in its entirety, but if you need me to create a standalone test bed to replicate the issue, I still have my original failing .sbs file and could make an otherwise-empty project or just send you that file by PM.

    Finally, I should let you know that the link from the Asset Store page to the upgrade instructions is outdated and goes to the following "page not found" error: https://docs.substance3d.com/display/integrations/Upgrading+Projects. When someone is in the Asset Publisher portal correcting that, perhaps they could consider adding a link to the plugin documentation ToC as well?

    Thanks for listening. I was very glad to get back into Substance this week, because I love this tool set and have missed working with Substance! Keep up the great work.
     
    Last edited: Oct 16, 2019
  46. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    242
    Substance plugin v2.4.0 crashes my project using unity 2019.2.8f and 2019.2.9f
    Tried to downgrade to the old one by deleting and copying the old folder and still crashing, so I'm left with a project without substance support.
    Anyone else having this problem ?
    EDIT: apparently was one of the substances in the project causing the crash
     
    Last edited: Oct 12, 2019
  47. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    I found a possible DLL bug with Substance Plugin (from the Asset Store, latest version as of today) in Unity 2018.1.9.

    To pretest an upgrade of a large project from 2017.4.31 to 2018.1.9, I exported all the .sbsar files as a Unity Package onto my local system. I created a new, empty project on Unity 2017.4.31 and imported only this Unity Package, verifying that the materials all worked using the last embedded Substance engine.

    Then, based on the instructions on the Substance web site, I closed and reopened this test project in Unity 2018.1.9 and installed the Substance plugin from the Asset Store. The plugin installed correctly but didn't immediately update the Substance materials (because in this test project I had only an empty scene, so the plugin had no reason to touch the .sbsar files).

    When I reimported any of the Substance files using the Unity Editor context menu, Unity crashed with a Windows popup indicating that the runtime had asked the system to terminate the application in an "unusual way". Looking at the Unity Editor logs, I observed the following:

    Code (CSharp):
    1. MissingMethodException: Method not found: 'UnityEngine.Material.GetTexturePropertyNames'.
    2.   at Substance.Game.NativeCallbacks.csGameTextureCallback (System.String assetPath, IntPtr preComputeCallback, UInt32 outputHash, Int32 format, Int32 channelsOrder, Int32 width, Int32 height, Int32 mipCount, IntPtr sPixels) [0x00000] in <filename unknown>:0
    3.   at (wrapper native-to-managed) Substance.Game.NativeCallbacks:csGameTextureCallback (intptr,intptr,uint,int,int,int,int,int,intptr)
    4.   at (wrapper managed-to-native) object:wrapper_native_00007FFA0E825230 ()
    5.   at Substance.Game.NativeFunctions_STANDALONE.cppProcessQueuedOutputs () [0x00000] in <filename unknown>:0
    6.   at Substance.Game.NativeFunctions.cppProcessQueuedOutputs () [0x00000] in <filename unknown>:0
    7.   at Substance.Game.NativeCallbacks+Renderer.ProcessJobs () [0x00000] in <filename unknown>:0
    8.   at Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) [0x00000] in <filename unknown>:0
    9.   at UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) [0x00003] in C:\buildslave\unity\build\Editor\Mono\AssetPipeline\ScriptedImporter.cs:19
    10.  
    11. (Filename: C:/buildslave/unity/build/Editor/Mono/AssetPipeline/ScriptedImporter.cs Line: 19)
    12.  
    13. Asset import failed, "Assets/Completed Art Assets/Substance Materials/Bar_Stool_MAT.sbsar" > MissingMethodException: Method not found: 'UnityEngine.Material.GetTexturePropertyNames'.
    14. Substance.Game.NativeCallbacks.csGameTextureCallback (System.String assetPath, IntPtr preComputeCallback, UInt32 outputHash, Int32 format, Int32 channelsOrder, Int32 width, Int32 height, Int32 mipCount, IntPtr sPixels)
    15. (wrapper native-to-managed) Substance.Game.NativeCallbacks:csGameTextureCallback (intptr,intptr,uint,int,int,int,int,int,intptr)
    16. Substance.Game.NativeFunctions_STANDALONE.cppProcessQueuedOutputs ()
    17. Substance.Game.NativeFunctions.cppProcessQueuedOutputs ()
    18. Substance.Game.NativeCallbacks+Renderer.ProcessJobs ()
    19. Substance.Editor.SubstanceImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx)
    20. UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Editor/Mono/AssetPipeline/ScriptedImporter.cs:19)
    21.  
    22.  
    23. (Filename: C:\buildslave\unity\build\Editor/Src/AssetPipeline/ScriptedImporter.cpp Line: 231)
    24.  
    25. done. [Time: 167.742900 ms]
    26. Refreshing native plugins compatible for Editor in 0.66 ms, found 8 plugins.
    27. Preloading 3 native plugins for Editor in 0.34 ms.
    28.  
    29. ----- Total AssetImport time: 0.246783s, AssetImport time: 0.196092s, Asset hashing: 0.000979s [265.9 KB, 265.121277 mb/s]
    30.  
    31. Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.014645 seconds (Nothing changed)
    32. Refresh completed in 0.014915 seconds.
    33. Missing method UnityEngine.Material::GetTexturePropertyNames() in assembly C:\Program Files\Unity\Hub\Editor\2018.1.9f2\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll, referenced in assembly C:\Projects\Unity\SubstanceTo2018-Test\Assets\Allegorithmic\Plugins\Substance\Substance Engine\Editor\Substance.Editor.dll
    Assuming this might be a change in the Unity APIs between 2018.1 and 2018.2, I tried reopening the test project in Unity 2018.2.2. This time, there was no crash. There were a lot of console errors about trying to reference an asset that had already been imported, but when I cleared the console and reimported all the substances once again, everything was clean and there were no further errors.

    With 2018.1, the crash was 100% repeatable for me.

    The bottom line is that I have a workaround, simply to move directly from 2017.4 to 2018.2, but I thought I should mention the problems with 2018.1 in case someone else encounters this.
     
  48. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    518
  49. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    What version of .NET do you have set for the project? I just did an upgrade of a large project for a customer, very similar versions, and I had all kinds of Substance problems until I changed .NET from 3.5 to 4.0 (and later to 2.0 Standard). I did the upgrade from 2017.4 to 2018.4 incrementally:
    • 2017.4 to 2018.2 (skipped 2018.1 because the Substance plugin was crashing the editor for me in 2018.1)
    • 2018.2 to 2018.4 (skipped 2018.3 after pre-testing and review of changelogs indicated this project could do that; YMMV)
    I upgraded .NET from 3.5 to 4.0 during the 2018.2 migration, and all the .sbsar files converted. Then I upgraded to 2018.4, and they all appeared to fail again (with the "Substance is no longer in the Unity engine..." error), but this time that was fixed by first reimporting the Allegorithmic directory, and then reimporting each of the Substance files.

    An oddity I found was that within each folder, the first .sbsar I reimported would always fail -- exactly once. Then if I repeated the reimport, it worked, and all the others in that folder would also work on the first try. I have absolutely no explanation for this. I was in the middle of a code freeze for the migration, and with the rest of the team waiting for me I didn't have time to investigate further, so I used my workaround and moved on. After this hiccup, everything was fine, but we've had to have each team member reimport the Assets/Allegorithmic folder to force the plugin to recompile. I think this has something to do with Unity's order of reimporting scripts and assemblies during the version upgrade.

    I hope this helps, but would caution that it's very project-specific to my work, and that I don't claim to have done a proper root cause analysis here. Since the upgrade was a one-off for the project team, my interest was in getting past it and back to development.
     
    Whatever560 likes this.
  50. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    518
    Thanks for your concerns and the information,

    I'm using .net 4x, I believe there is an issue with the meta files parsing. I'm creating several materials out of one substance and maybe this use case was not clearly handled in the plugin yet. Substances that I simply imported without creating materials out of them are importing correctly.

    I sent some files to @wesm and am waiting for his diagnosis.
     
    syscrusher likes this.