britzldefold-metrics
britzl/defold-metrics/metrics.mem
Calculate and display performance metrics in Defold games
- GitHub: britzl/defold-metrics — pinned to
1.2.1- Pick a release from britzl/defold-metrics releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as mem from "metrics.mem"
- Pick a release from britzl/defold-metrics releases and add its Source code (zip) URL (or a packaged
Functions
create(format?: string, position?: Vector3, color?: Vector4): Metrics
Parameters
format?:stringposition?:Vector3color?:Vector4
Returns
Metrics
update()
Call this to get a new memory usage reading.
mem(): number
Get the current memory usage, in kilobytes.
Returns
number
draw()
Draw memory usage text using draw_debug_text.
Variables
POSITION: Vector3
Where draw() places the text, and the default create() uses when given no position.
FORMAT: string
The string.format pattern the memory reading is rendered through.
COLOR: Vector4
The colour draw() renders the text in, and the default create() uses when given no colour.