Class DrawingData

Public

Helper for drawing Gizmos in a performant way.

This is a replacement for the Unity Gizmos class as that is not very performant when drawing very large amounts of geometry (for example a large grid graph). These gizmos can be persistent, so if the data does not change, the gizmos do not need to be updated.

How to use

  • Create a Hasher object and hash whatever data you will be using to draw the gizmos Could be for example the positions of the vertices or something. Just as long as if the gizmos should change, then the hash changes as well.

  • Check if a cached mesh exists for that hash

  • If not, then create a Builder object and call the drawing methods until you are done and then call Finalize with a reference to a gizmos class and the hash you calculated before.

  • Call gizmos.Draw with the hash.

  • When you are done with drawing gizmos for this frame, call gizmos.FinalizeDraw

Inner Types

Combines hashes into a single hash value.

Public Methods

ClearData ()

Destroys all cached meshes.

Public
Draw (hasher)

Schedules the meshes for the specified hash to be drawn.

Public
Draw (scope)

Schedules all meshes that were drawn the last frame with this redraw scope to be drawn again.

Public
GetBuilder (renderInGame=…)

Get an empty builder for queuing drawing commands.

Public
GetBuilder (redrawScope, renderInGame=…)

Get an empty builder for queuing drawing commands.

Public
GetBuilder (hasher, redrawScope=…, renderInGame=…)

Get an empty builder for queuing drawing commands.

Public
Render (cam, allowGizmos, commandBuffer)

Call after all Draw commands for the frame have been done to draw everything.

Public
TickFrame ()
Public

Public Variables

frameRedrawScope
Public
lineMaterial

Material to use for the navmesh outline in the editor.

Public
surfaceMaterial

Material to use for the navmesh in the editor.

Public
version
Public

Private/Protected Members

cachedMeshes
Private
cameraVersions
Private
data
Package
DiscardData (hasher)
Private
frustrumPlanes
Private
GetMesh ()
Package
lastTickVersion
Private
lastTickVersion2
Private
meshes
Private
PoolMesh (mesh)
Private
processedData
Package