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.

Question No Runtime Mesh in MeshMaterialInfo

Discussion in 'Graphics for ECS' started by StefanWo, Feb 20, 2023.

  1. StefanWo

    StefanWo

    Joined:
    May 24, 2015
    Posts:
    106
    At the new 1.0.0-pre44 version it looks like the GetMesh fails, due to its now possible to be a non-runtime value. I thought in the previous version this was working fine (i used reflection to call it) (but maybe i was wrong, long time ago).

    Most of the methods i need to resolve the baked mesh/material by myself are internal, are there any ways i missed? Or is it a bug, that its not resolved to a runtime mesh anymore?
     
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    288
    That is correct, recent versions of the package have removed the "always convert to runtime values" behavior, partly because it was confusing, but most importantly because it caused a lot of bugs when combined with live baking and incremental changes to entities.

    GetMesh is also now public, so reflection is no longer necessary, but at the same time it is unfortunately less useful for this use case since MaterialMeshInfo will typically contain an array index. Those can be resolved into Mesh objects using the
    public Mesh GetMesh(MaterialMeshInfo materialMeshInfo)
    method in RenderMeshArray.
     
    StefanWo likes this.
  3. StefanWo

    StefanWo

    Joined:
    May 24, 2015
    Posts:
    106
    I already needed do downgrade, due to massive bugs in all parts of the new system, but as i remember, the IsRuntimeMesh and other needed Methods of the MaterialMeshInfo and other needed Methods were not public.
    Maybe it would be good to recheck that :)