Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

2020.1 Beta 5 & Latest related packages for Hybrid Render V2 - No Entities Showing

Discussion in '2020.1 Beta' started by GDevTeam, Apr 11, 2020.

  1. GDevTeam

    GDevTeam

    Joined:
    Feb 14, 2014
    Posts:
    90
    2020.1 Beta 5 & Latest related packages for Hybrid Render V2 - No Entities Showing
    (I've already asked in the DOTS related sub-forum, I thought I'd give it a try in the beta forum next)


    I feel this is something simple I'm overlooking?

    If I add a sphere with a Convert to Entity component, that will show up in Play Mode. But the following code will no longer (it worked fine in 2019.3 with HR V1) present the Entities I expected at Play Mode time.

    Any ideas why not? (I'm using URP)

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Unity.Entities;
    5. using Unity.Mathematics;
    6. using Unity.Transforms;
    7. using Unity.Rendering;
    8. using Unity.Jobs;
    9.  
    10. public class CreateCapsuleSystem : JobComponentSystem
    11. {
    12.     protected override void OnCreate()
    13.     {
    14.         base.OnCreate();
    15.  
    16.         for (int i = 0; i < 100; i++)
    17.         {
    18.  
    19.             var instance = EntityManager.CreateEntity(
    20.                 ComponentType.ReadOnly<LocalToWorld>(),
    21.                 ComponentType.ReadWrite<Translation>(),
    22.                 ComponentType.ReadWrite<Rotation>(),
    23.                 ComponentType.ReadWrite<NonUniformScale>(),
    24.                 ComponentType.ReadOnly<RenderMesh>()
    25.                 );
    26.  
    27.  
    28.             float3 position = new float3(UnityEngine.Random.Range(-10, 10), 0, UnityEngine.Random.Range(-10, 10));
    29.             float scale = UnityEngine.Random.Range(1, 10);
    30.             EntityManager.SetComponentData(instance,
    31.                 new LocalToWorld
    32.                 {
    33.                     Value = new float4x4(rotation: quaternion.identity, translation: position)
    34.                 });
    35.             EntityManager.SetComponentData(instance, new Translation { Value = position });
    36.             EntityManager.SetComponentData(instance, new Rotation { Value = new quaternion(0, 0, 0, 0) });
    37.             EntityManager.SetComponentData(instance, new NonUniformScale { Value = new float3(scale, scale, scale) });
    38.             var rHolder = Resources.Load<GameObject>("ResourceHolder").GetComponent<ResourceHolder>();
    39.  
    40.             EntityManager.SetSharedComponentData(instance,
    41.                 new RenderMesh
    42.                 {
    43.                     mesh = rHolder.theMesh,
    44.                     material = rHolder.theMaterial
    45.                 });
    46.         }
    47.     }
    48.  
    49.  
    50.     protected override JobHandle OnUpdate(JobHandle inputDeps)
    51.     {
    52.         return inputDeps;
    53.     }
    54. }
    55.  
     

    Attached Files:

  2. gnostici

    gnostici

    Joined:
    Jul 27, 2013
    Posts:
    23
    I can't see your material, but if you're setting "_MainTex" or otherwise using MainTexture, you may have no texture at all. HDRP shaders at least will often ignore that texture. Run this:


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. namespace Helpers
    6. {
    7.     public struct ShaderTool
    8.     {
    9.         public static void LogProperties(Material material)
    10.         {
    11.             for(int i = 0; i < material.shader.GetPropertyCount(); i++)
    12.             {
    13.                 Debug.Log(i + "..........................................................................................................");
    14.                 Debug.Log("Property Name " + i + ": " + material.shader.GetPropertyName(i) + "\n");
    15.                 Debug.Log("Property Description " + i + ": " + material.shader.GetPropertyDescription(i) + "\n");
    16.                 Debug.Log("Property Type " + i + ": " + material.shader.GetPropertyType(i) + "\n");
    17.                 Debug.Log("Property NameID " + i + ": " + material.shader.GetPropertyNameId(i) + "\n");
    18.                 if(material.shader.GetPropertyAttributes(i).Length > 0)
    19.                 {
    20.                     Debug.Log("Property " + i + " Attributes: \n");
    21.                     for(int j = 0; j < material.shader.GetPropertyAttributes(i).Length; j++)
    22.                     {
    23.                         Debug.Log("     " + i + "." + j + ": " + material.shader.GetPropertyAttributes(i)[j] + "\n");
    24.                     }
    25.                 }
    26.             }
    27.         }
    28.     }
    29. }
    30.  
    All your material's shader properties will be output to the log. In there, you'll likely find a texture and color property that seems to fit your shader. For example, Unlit shaders may use _UnlitColor and _UnlitColorMap.

    This can drive ya nuts, because everything will seem perfect so far as anything written almost anywhere.
     
    GDevTeam likes this.