Search Unity

Question Shader makes compilation errors

Discussion in 'Addressables' started by arczi79, Jun 2, 2022.

  1. arczi79

    arczi79

    Joined:
    May 10, 2021
    Posts:
    45
    Hello,

    I am not sure if it is something with Addressables or with the shader provided with the
    Polaris 2021 - Low Poly & Mesh Terrain Editor but whenever one shader (URP_GradientLookup_SG) is used in the project I'am getting these errors when trying to build Addressables Group (more in the attachment to this topic):

    Code (CSharp):
    1. Assertion failed on expression: 'lhsType != NULL'
    2. 0x00007ff7f6b5726c (Unity) StackWalker::GetCurrentCallstack
    3. 0x00007ff7f6b5f649 (Unity) StackWalker::ShowCallstack
    4. 0x00007ff7f80424ac (Unity) GetStacktrace
    5. 0x00007ff7f9145af3 (Unity) DebugStringToFile
    6. 0x00007ff7f91457f2 (Unity) AssertImplementation
    7. 0x00007ff7f833cc87 (Unity) BuildPipeline::CompareObjectIdentifierForPrepareScene
    8. 0x00007ff7f833343e (Unity) std::_Insertion_sort_unchecked<BuildPipeline::ObjectIdentifier * __ptr64,bool (__cdecl*)(BuildPipeline::ObjectIdentifier const & __ptr64,BuildPipeline::ObjectIdentifier const & __ptr64)>
    9. 0x00007ff7f8332832 (Unity) std::_Buffered_merge_sort_unchecked<BuildPipeline::ObjectIdentifier * __ptr64,bool (__cdecl*)(BuildPipeline::ObjectIdentifier const & __ptr64,BuildPipeline::ObjectIdentifier const & __ptr64)>
    10. 0x00007ff7f8336d72 (Unity) std::_Stable_sort_unchecked<BuildPipeline::ObjectIdentifier * __ptr64,bool (__cdecl*)(BuildPipeline::ObjectIdentifier const & __ptr64,BuildPipeline::ObjectIdentifier const & __ptr64)>
    11. 0x00007ff7f833c3c8 (Unity) BuildPipeline::CalculatePlayerDependenciesForScene
    12. 0x00007ff7f8832c8c (Unity) ContentBuildInterface_CUSTOM_CalculatePlayerDependenciesForSceneInternal_Injected
    13. 0x0000025d3078fbc1 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.Build.Content.ContentBuildInterface:CalculatePlayerDependenciesForSceneInternal_Injected (string,UnityEditor.Build.Content.BuildSettings&,UnityEditor.Build.Content.BuildUsageTagSet,UnityEditor.Build.Content.BuildUsageCache,UnityEditor.Build.Content.DependencyType,UnityEditor.Build.Content.SceneDependencyInfo&)
    14. 0x0000025d3078f9bb (Mono JIT Code) UnityEditor.Build.Content.ContentBuildInterface:CalculatePlayerDependenciesForSceneInternal (string,UnityEditor.Build.Content.BuildSettings,UnityEditor.Build.Content.BuildUsageTagSet,UnityEditor.Build.Content.BuildUsageCache,UnityEditor.Build.Content.DependencyType)
    15. 0x0000025d3078f55b (Mono JIT Code) UnityEditor.Build.Content.ContentBuildInterface:CalculatePlayerDependenciesForScene (string,UnityEditor.Build.Content.BuildSettings,UnityEditor.Build.Content.BuildUsageTagSet,UnityEditor.Build.Content.BuildUsageCache)
    16. 0x0000025d3077be53 (Mono JIT Code) [CalculateSceneDependencyData.cs:106] UnityEditor.Build.Pipeline.Tasks.CalculateSceneDependencyData:Run ()
    17. 0x0000025d3065f017 (Mono JIT Code) [BuildTasksRunner.cs:56] UnityEditor.Build.Pipeline.BuildTasksRunner:Run (System.Collections.Generic.IList`1<UnityEditor.Build.Pipeline.Interfaces.IBuildTask>,UnityEditor.Build.Pipeline.Interfaces.IBuildContext)
    18. 0x0000025d3064cda3 (Mono JIT Code) [ContentPipeline.cs:145] UnityEditor.Build.Pipeline.ContentPipeline:BuildAssetBundles (UnityEditor.Build.Pipeline.Interfaces.IBundleBuildParameters,UnityEditor.Build.Pipeline.Interfaces.IBundleBuildContent,UnityEditor.Build.Pipeline.Interfaces.IBundleBuildResults&,System.Collections.Generic.IList`1<UnityEditor.Build.Pipeline.Interfaces.IBuildTask>,UnityEditor.Build.Pipeline.Interfaces.IContextObject[])
    19. 0x0000025d30638a5b (Mono JIT Code) [BuildScriptPackedMode.cs:177] UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode:DoBuild<TResult_REF> (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput,UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext)
    20. 0x0000025d30611b28 (Mono JIT Code) [BuildScriptPackedMode.cs:77] UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode:BuildDataImplementation<TResult_REF> (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput)
    21. 0x0000025d304ce07d (Mono JIT Code) [BuildScriptBase.cs:84] UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase:BuildData<TResult_REF> (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput)
    22. 0x0000025d304cbc25 (Mono JIT Code) [AddressableAssetSettings.cs:1921] UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContentImpl ()
    23. 0x0000025d304cb71b (Mono JIT Code) [AddressableAssetSettings.cs:1903] UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContent ()
    24. 0x0000025d304cad83 (Mono JIT Code) [AddressableAssetsSettingsGroupEditor.cs:273] UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor:OnBuildPlayerData ()
    25. 0x0000025d304ca8b3 (Mono JIT Code) [AddressableAssetsSettingsGroupEditor.cs:268] UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor:OnBuildScript (object)
    26. 0x0000025d3045e586 (Mono JIT Code) UnityEditor.GenericMenu:CatchMenu (object,string[],int)
    27. 0x0000025d3045e1cf (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void__this___object_object_int (object,intptr,intptr,intptr)
    28. 0x00007ffa7721e630 (mono-2.0-bdwgc) [mini-runtime.c:2812] mono_jit_runtime_invoke
    29. 0x00007ffa771a2ac2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke
    30. 0x00007ffa771abb1f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke
    31. 0x00007ff7f69cf5b4 (Unity) scripting_method_invoke
    32. 0x00007ff7f69c7f05 (Unity) ScriptingInvocation::Invoke
    33. 0x00007ff7f74bb9ba (Unity) CustomPopupMenuInterface::Execute
    34. 0x00007ff7f748077d (Unity) MenuController::ExecuteMenuItem
    35. 0x00007ff7f806e514 (Unity) ShowDelayedContextMenu
    36. 0x00007ff7f8084026 (Unity) GUIView::OnInputEvent
    37. 0x00007ff7f75f7428 (Unity) GUIView::ProcessInputEvent
    38. 0x00007ff7f807ae82 (Unity) GUIView::DoPaint
    39. 0x00007ff7f808718d (Unity) GUIView::RepaintAll
    40. 0x00007ff7f76db36d (Unity) Application::TickTimer
    41. 0x00007ff7f804bca1 (Unity) MainMessageLoop
    42. 0x00007ff7f804fce1 (Unity) WinMain
    43. 0x00007ff7f9ea0ef6 (Unity) __scrt_common_main_seh
    44. 0x00007ffaf7837034 (KERNEL32) BaseThreadInitThunk
    45. 0x00007ffaf7b22651 (ntdll) RtlUserThreadStart
    It is very easy to replicate the errors from the build proces:
    1. Unity 2020.3.9f1
    2. Create new URP project
    3. Import Addressables package from the Package Manager -> Unity Registry
    4. Import Polaris 2021.1.11 from the Package Manager
    5. Create any size terrain with the Polaris Terrain Wizard (but use Gradient Lookup in the "Set Shader" panel), save scene
    6. Toolbar->Window->Asset Managment->Addressables->Group will display you Addressables Groups panel
    7. Create any group on this new "Addressables Groups" panel
    8. Find your scene in the Project panel and mark checkbox "Addressables" in the Inspector
    9. Select Build->New Build-> Default Build Script in the right top corner of the panel "Addressables Groups"
    10. Errors as in the TXT file attached to this thread are thrown

    Any idea why I am getting these errors?
    Thank you in advance for any help!
     

    Attached Files:

  2. arczi79

    arczi79

    Joined:
    May 10, 2021
    Posts:
    45
    ...one more experiment:

    1. From the scene I removed terrain which was generated by the Polaris Wizard
    2. I have added a basic cube to scene
    3. Next I changed material on cube to URP_GradientLookup_SG

    ...and building Addressables Group doesn't produce any errors.
    So it looks like something is wrong only when the URP_GradientLookup_SG shader is used on the automatically generated terrain.
     
  3. arczi79

    arczi79

    Joined:
    May 10, 2021
    Posts:
    45
    ...now it is starting to be a little strange:

    1. Again I have Scene with terrain generated by the Polaris Wizard
    2. Again scene uses URP_GradientLookup_SG shader on the generated terrain
    3. This time I have unmarked checkbox "Addressable" on the whole Scene
    4. ...and I made prefab from the generated terrain and marked checkbox "Addressables" only on this prefab

    ...and building Addressables Group doesn't produce any errors.
    What is going on? Why am I getting these build errors (from the first thread) when trying to mark the whole scene as an addressable asset? Everything works if the terrain is built with a different shader, everything works if the scene doesn't contain the terrain with the problematic shader but the shader is still in the scene, everything works when only the terrain is an addressable asset (instead the whole scene).

    Please help to resolve this mysterious problem.
     
  4. arczi79

    arczi79

    Joined:
    May 10, 2021
    Posts:
    45
    And here is the issue demonstrated in a few pictures:

    ERR_01.png

    ERR_02.png

    ERR_03.png

    ERR_04.png

    ERR_05.png
     
  5. arczi79

    arczi79

    Joined:
    May 10, 2021
    Posts:
    45
    And the problematic task from the Default Build Script:

    Problematic task.png

    Problematic task 2.png

    If the scene is not marked as an Addressable then I can build project without any issues....
    Does anyone know what CalculatePlayerDependenciesForScene(.....) should validate?
     
    Last edited: Jun 2, 2022
  6. arczi79

    arczi79

    Joined:
    May 10, 2021
    Posts:
    45
    Last edited: Jun 2, 2022