Search Unity

Most efficient way to load/create Raycast targets (e.g. Colliders)?

Discussion in 'Scripting' started by MNNoxMortem, Oct 13, 2019.

  1. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    This thread is the non-DOTS version of Most efficient way to load/create Raycast targets (e.g. Colliders) with DOTS?

    What is the most efficient way to load/create/serialize/deserialize a (Mesh)Collider?

    The goal is to be able to as fast as possible load a mesh from disk, raycast against it to determine:
    • Vector3 hitpoint
    • int triangle index
    and then unload it again.

    My current plan is to use MessagePack-CSharp as fast deserializer, but letting Unity create the MeshCollider is a huge bottleneck and I have not found a way to (de)serialize a MeshCollider more efficient.