Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved (Rendering) Declare referenced Shader Assets?

Discussion in 'Project Tiny' started by JonasMumm, Mar 13, 2020.

  1. JonasMumm


    Feb 22, 2019
    Hello, I've been running into the following issue using Project Tiny 0.22:

    I created a custom shader to be used on a material in my scene, and it displays correctly inside the Editor, but when I build my project none of the Entities that had the material with the custom shader assigned to their MeshRenderer components before conversion are visible. Do I need to somehow declare the shaders I'm using on-top of declaring the materials themselves?

    Some more details from trying to solve this issue:
    • I used DeclareReferencedAsset() both with the shader's material and the shader itself inside a GameObjectConversionSystem, but with no luck.
    • Changing the material's shader to a default LWRP one results in the Entities rendering as expected in the build.
    • I added my custom shader to the list of Always Included Shaders in the Graphic Settings.
    • I poked around the Tiny.Rendering Package and this bit of code in ExportShaders.cs forges my assumption that as of now the Tiny.Rendering package only supports selected built-in shaders?
      Code (CSharp):
      1.             //Export shaders per build target
      2.             var targetName = profile.Target.UnityPlatformName;
      3.             bgfx.RendererType[] types = GetShaderFormat(targetName);
      4.             PrecompiledShaders data = new PrecompiledShaders();
      6.             data.SimpleShader = CreateShaderDataEntity(EntityManager, ShaderType.simple, types);
      7.             data.LitShader = CreateShaderDataEntity(EntityManager, ShaderType.simplelit, types);
      8.             data.LineShader = CreateShaderDataEntity(EntityManager, ShaderType.line, types);
      9.             data.ZOnlyShader = CreateShaderDataEntity(EntityManager, ShaderType.zOnly, types);
      10.             data.BlitSRGBShader = CreateShaderDataEntity(EntityManager, ShaderType.blitsrgb, types);
      11.             data.ShadowMapShader = CreateShaderDataEntity(EntityManager, ShaderType.shadowmap, types);
      12.             data.SpriteShader = CreateShaderDataEntity(EntityManager, ShaderType.sprite, types);
      14.             var singletonEntity = EntityManager.CreateEntity();
      15.             EntityManager.AddComponentData<PrecompiledShaders>(singletonEntity, data);
    Last edited: Mar 13, 2020
  2. AbdulAlgharbi


    Unity Technologies

    Jul 27, 2018
    We currently only support URP lit and unlit shaders
    custom shaders are on the way and planned for the upcoming releases
    JonasMumm and Sarkahn like this.
  3. JonasMumm


    Feb 22, 2019
    Thank you clearing this up, I'm looking forward to custom shaders :)