Skip to content

Instantly share code, notes, and snippets.

@ottah
ottah / optimizations.md
Created June 20, 2022 13:15 — forked from mandarinx/optimizations.md
Unity3D optimization tips

Unity3D optimization tips

Some code allocates memory when running in the editor and not on the device. This is due to Unity doing some extra error handling so possible error messages can be output in the console. Much of this code is stripped during build. It's therefore important to profile on device, and do it regularly.

Optimizations often makes code more rigid and harder to reason. Don't do it until you really need to.

When profiling, wrap methods or portions of a method in Profiler.BeginSample(string name) and Profiler.EndSample() to make them easier to find in the profiler.

public class SomeClass {
import {_Window} from 'openfin/_v2/api/window/window';
import {WindowOption} from 'openfin/_v2/api/window/windowOption';
export interface WebWindow {
document: Document;
window: _Window;
}
/**
* Create a WebWindow with access to v1 & v2 window methods & properties. This will be replaced when getWebWindow() gets added to the stable release channel.