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

Does ScriptedImporter optimize Mesh assets?

Discussion in 'Editor Workflows' started by holo-krzysztof, Jan 12, 2018.

  1. holo-krzysztof

    holo-krzysztof

    Joined:
    Apr 5, 2017
    Posts:
    77
    I'm currently writing a custom importer for a rather obscure file format and I've come across the MeshUtility.Optimize API.

    The question is, does the asset pipeline do it automatically or do I have to call it myself after extracting data from the file and creating my Mesh? The documentation is ambiguous in this case, since it's "procedurally generated" (read from a file and constructed in code) but still kinda using the import pipeline.

    Can somebody with internal knowledge clarify this?
     
  2. mahdi_jeddi

    mahdi_jeddi

    Joined:
    Jul 18, 2016
    Posts:
    246
    I think you should. As far as I know this function reorders the vertex indices to make them more cache friendly when being rendered. And because you're generating your own mesh with unoptimized index order, this should help making it faster to render.

    This should not change the mesh's visuals in anyway so no harm to just call it if not sure.