Skip to content

Instantly share code, notes, and snippets.

@akof1314
akof1314 / optimizations.md
Created August 11, 2016 03:40 — 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 {
@akof1314
akof1314 / HudControl.cs
Created March 3, 2016 12:10 — forked from westhillapps/HudControl.cs
uGUIで3D空間のオブジェクト上に追従するHUD制御用コンポーネント
using UnityEngine;
/// <summary>
/// uGUIで3D空間のオブジェクト上に追従するHUD制御用コンポーネント
/// </summary>
public class HudControl : MonoBehaviour
{
public Transform targetTrans;
public Vector3 offset = Vector3.zero;