Predefined Live Templates for Unity
This topic lists all predefined live templates for Unity in ReSharper 2024.2. For more information about live templates, refer to Create source code using live templates.
Template | Details |
---|---|
| Current file context Scope Everywhere Body $CTX$ Parameters
|
| Insert new GUID Scope Everywhere Body $GUID$ Parameters
|
| Unity CreateAssetMenu attribute Scope C# 2.0+ types and namespaces, Unity C# file Body [UnityEngine.CreateAssetMenu(fileName = $FILENAME$, menuName = $MENUNAME$, order = $ORDER$)] Parameters
|
| Unity log warning Scope C# 2.0+ statements, Unity C# file Body UnityEngine.Debug.LogWarning($VAR$); Parameters
|
| Unity log exception Scope C# 2.0+ statements, Unity C# file Body UnityEngine.Debug.LogException($VAR$); Parameters
|
| Unity menu item handler Scope C# 2.0+ type members, Unity C# file Body [UnityEditor.MenuItem($MENUNAME$)]
public static void $NAME$()
{
$END$
} Parameters
|
| Unity serialized field Scope C# 2.0+ type members, Unity serializable type members Body [UnityEngine.SerializeField] private $TYPE$ $NAME$;$END$ Parameters
|
| Unity log error Scope C# 2.0+ statements, Unity C# file Body UnityEngine.Debug.LogError($VAR$); Parameters
|
| Unity log object/message Scope C# 2.0+ statements, Unity C# file Body UnityEngine.Debug.Log($VAR$); Parameters
|
| Unity RequireComponent attribute Scope C# 2.0+ types and namespaces, Unity C# file Body [UnityEngine.RequireComponent(typeof($TYPE$))] Parameters
|
| Unity property with serialized backing field Scope C# 2.0+ type members, Unity serializable type members Body [UnityEngine.SerializeField] private $type$ $fieldName$;
public $type$ $propertyName$ { get { return this.$fieldName$; } }$END$ Parameters
|
| Unity coroutine method Scope C# 2.0+ type members, Unity C# file Body private System.Collections.IEnumerator $NAME$()
{
$END$yield break;
} Parameters
|
| Unity log variable Scope C# 2.0+ statements, Unity C# file Body UnityEngine.Debug.Log("$VAR$ = " + $VAR$); Parameters
|
| ShaderLab Integer property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", Integer) = $VALUE$$END$ Parameters
|
| ShaderLab Blend 2x multiplicative (srcdst+dstsrc) Scope Unity ShaderLab Category Block, Unity ShaderLab SubShader Block, Unity ShaderLab Pass Block Body Blend DstColor SrcColor |
| ShaderLab Float property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", Float) = $VALUE$$END$ Parameters
|
| ShaderLab Surface Shader Scope Unity ShaderLab Shader Block Body SubShader
{
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input
{
float4 color : COLOR;
};
void surf(Input IN, inout SurfaceOutput o)
{
o.Albedo = 1;
}
ENDCG
} |
| ShaderLab Shader block Scope Unity ShaderLab Root Body Shader "$NAME$"
{
$END$
} Parameters
|
| ShaderLab 3D property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", 3D) = "$TEXTURE$" { $END$ } Parameters
|
| ShaderLab Vector property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", Vector) = ($X$, $Y$, $Z$, $W$)$END$ Parameters
|
| ShaderLab Blend soft additive (src*(1-dst)+dst) Scope Unity ShaderLab Category Block, Unity ShaderLab SubShader Block, Unity ShaderLab Pass Block Body Blend OneMinusDstColor One |
| ShaderLab Blend additive (src + dst) Scope Unity ShaderLab Category Block, Unity ShaderLab SubShader Block, Unity ShaderLab Pass Block Body Blend One One |
| ShaderLab Vertex/Fragment Shader Scope Unity ShaderLab Shader Block Body SubShader
{
Tags { "RenderType"="Opaque" }
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}
half4 frag (v2f i) : SV_Target
{
return 1;
}
ENDCG
}
} |
| ShaderLab 2D property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", 2D) = "$TEXTURE$" { $END$ } Parameters
|
| ShaderLab Blend traditional transparency (src*srcAlpha+(1-srcAlpha)*dst) Scope Unity ShaderLab Category Block, Unity ShaderLab SubShader Block, Unity ShaderLab Pass Block Body Blend SrcAlpha OneMinusSrcAlpha |
| ShaderLab CubeArray property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", CubeArray) = "$TEXTURE$" { $END$ } Parameters
|
| ShaderLab Blend multiplicative (src*dst) Scope Unity ShaderLab Category Block, Unity ShaderLab SubShader Block, Unity ShaderLab Pass Block Body Blend DstColor Zero |
| ShaderLab Cube property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", Cube) = "$TEXTURE$" { $END$ } Parameters
|
| ShaderLab 2DArray property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", 2DArray) = "$TEXTURE$" { $END$ } Parameters
|
| ShaderLab Color property Scope Unity ShaderLab Properties Block Body _$NAME$("$NAME$", Color) = ($R$, $G$, $B$, $A$)$END$ Parameters
|
| ShaderLab Blend premultiplied transparency (src+(1-srcAlpha)*dst) Scope Unity ShaderLab Category Block, Unity ShaderLab SubShader Block, Unity ShaderLab Pass Block Body Blend One OneMinusSrcAlpha |
| ShaderLab Vertex/Fragment Shader Pass Scope Unity ShaderLab SubShader Block Body Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}
half4 frag (v2f i) : SV_Target
{
return 1;
}
ENDCG
} |