Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How do you pass in mesh render data in version 0.12?

Discussion in 'Graphics for ECS' started by HeyZoos, Feb 20, 2019.

  1. HeyZoos

    HeyZoos

    Joined:
    Jul 31, 2016
    Posts:
    50
    Code (CSharp):
    1.  
    2. public class Bootstrap : MonoBehaviour
    3. {
    4.     public static RenderMesh playerRenderMesh;
    5.  
    6.     void Start()
    7.     {
    8.         GameObject playerPrototype = GameObject.Find("Player");
    9.         playerRenderMesh = playerPrototype.GetComponent<MeshRendererComponent>();   // ?
    10.     }
    11. }
    12.  
     
  2. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    You need to get the value from the wrapper. So it would be like:

    playerPrototype.GetComponent<MeshRendererComponent>().Value;
     
    HeyZoos likes this.
  3. Akansh

    Akansh

    Joined:
    Feb 24, 2013
    Posts:
    27
    In the latest update they changed the component wrappers to proxies.

    Code (CSharp):
    1. RenderMesh prototypeMesh = prototype.GetComponent<RenderMeshProxy>().Value;
     
  4. L2GX

    L2GX

    Joined:
    Aug 19, 2016
    Posts:
    42
    I've been trying to add a RenderMeshProxy to a new entity. VisualStudio doesn't find the type or namespace, and when I add 'using System; using UnityEngine;
    using UnityEngine.Rendering;' it tells me these are not needed
     
  5. Bas-Smit

    Bas-Smit

    Joined:
    Dec 23, 2012
    Posts:
    274
    I had to clear the package caches (I reimported all, but you can remove it from Library). The package manager is very buggy :'(
     
  6. Akansh

    Akansh

    Joined:
    Feb 24, 2013
    Posts:
    27
    The component to add is still a RenderMesh in your code. RenderMeshProxy is just a component wrapper (or proxy) to be able to see it as a component in the editor.

    https://github.com/AkanshDivker/Simple-ECS/blob/master/Assets/Scripts/SystemManager.cs
     
  7. L2GX

    L2GX

    Joined:
    Aug 19, 2016
    Posts:
    42
    I don't have RenderMesh, but I have MeshRenderer and MeshFilter...
     
  8. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    851
    Make sure you have the latest Entities package in the package manager as well as its dependencies.
     
  9. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    It's a separate package : com.unity.rendering.hybrid