Predefined File Templates for Unity
This topic lists all predefined file templates for Unity in JetBrains Rider 2023.3. For more information about file templates, refer to Create files from templates.
Template | Details |
---|---|
| Scope Unity DOTS projects Body $HEADER$namespace $NAMESPACE$ {
public struct $COMPONENT$ : Unity.Entities.IComponentData
{
$END$
}
} Parameters
|
| Assembly Definition File Scope Unity projects, Unity 2017.3 and later projects Body {
"name": "$NAME$"
} Parameters
|
| Play Mode Test Scope Unity projects Body $HEADER$namespace $NAMESPACE$ {
public class $CLASS$ {
[NUnit.Framework.Test]
public void $CLASS$SimplePasses() {
// Use the Assert class to test conditions.
$END$
}
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityEngine.TestTools.UnityTest]
public System.Collections.IEnumerator $CLASS$WithEnumeratorPasses() {
// Use the Assert class to test conditions.
// yield to skip a frame
yield return null;
}
}
} Parameters
|
| Scope Unity DOTS projects Body $HEADER$namespace $NAMESPACE$
{
public partial struct $JOBENTITY$ : Unity.Entities.IJobEntity
{
public void Execute($END$)
{
}
}
} Parameters
|
| Image Effect Shader Scope Unity projects Body Shader "Hidden/$NAME$"
{
$END$Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
sampler2D _MainTex;
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
// just invert the colors
col = 1 - col;
return col;
}
ENDCG
}
}
} Parameters
|
| Asset Postprocessor Scope Unity Editor folder Body $HEADER$namespace $NAMESPACE$ {
public class $CLASS$ : UnityEditor.AssetPostprocessor
{
public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
$END$
}
}
} Parameters
|
| Scriptable Object Scope Unity projects Body $HEADER$namespace $NAMESPACE$ {
[UnityEngine.CreateAssetMenu(fileName = "$FILENAME$", menuName = "$MENUNAME$", order = 0)]
public class $CLASS$ : UnityEngine.ScriptableObject
{
$END$
}
} Parameters
|
| Mono Behaviour Scope Unity projects Body $HEADER$namespace $NAMESPACE$ {
public class $CLASS$ : UnityEngine.MonoBehaviour {$END$}
} Parameters
|
| Editor Window Scope Unity Editor folder, Unity 2022.2 and later projects Body $HEADER$namespace $NAMESPACE$ {
public class $CLASS$ : UnityEditor.EditorWindow
{
[UnityEditor.MenuItem("$MENUITEM$/$MENUITEMCOMMAND$")]
private static void ShowWindow()
{
var window = GetWindow<$CLASS$>();
window.titleContent = new UnityEngine.GUIContent("$TITLE$");
window.Show();
}
private void CreateGUI()
{
$END$
}
}
} Parameters
|
| State Machine Behaviour Scope Unity projects Body $HEADER$namespace $NAMESPACE$ {
public class $CLASS$ : UnityEngine.StateMachineBehaviour
{
public override void OnStateEnter(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
{
$END$
}
public override void OnStateExit(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
{
}
public override void OnStateUpdate(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
{
}
public override void OnStateMove(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
{
}
public override void OnStateIK(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
{
}
}
} Parameters
|
| Editor EntryPoint C# script Scope Unity Editor folder Body $HEADER$namespace $NAMESPACE$ {
[UnityEditor.InitializeOnLoad]
public static class $CLASS$
{
static $CLASS$()
{$END$}
}
} Parameters
|
| Property Drawer (IMGUI) Scope Unity Editor folder, Unity 2022.1 and earlier projects Body $HEADER$namespace $NAMESPACE$ {
[UnityEditor.CustomPropertyDrawer(typeof($TYPE$))]
public class $CLASS$ : UnityEditor.PropertyDrawer
{
public override void OnGUI(UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label)
{
$END$
}
public override float GetPropertyHeight(UnityEditor.SerializedProperty property, UnityEngine.GUIContent label)
{
return base.GetPropertyHeight(property, label);
}
}
} Parameters
|
| Custom Editor (IMGUI) Scope Unity Editor folder, Unity 2022.1 and earlier projects Body $HEADER$namespace $NAMESPACE$ {
[UnityEditor.CustomEditor(typeof($TYPE$))]
public class $CLASS$ : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
$END$
base.OnInspectorGUI();
}
}
} Parameters
|
| Scope Unity DOTS projects Body $HEADER$namespace $NAMESPACE$ {
public partial struct $SYSTEM$ : Unity.Entities.ISystem
{
[Unity.Burst.BurstCompile]
public void OnCreate(ref Unity.Entities.SystemState state)
{
$END$
}
[Unity.Burst.BurstCompile]
public void OnUpdate(ref Unity.Entities.SystemState state)
{
}
[Unity.Burst.BurstCompile]
public void OnDestroy(ref Unity.Entities.SystemState state)
{
}
}
} Parameters
|
| Scriptable Wizard Scope Unity Editor folder Body $HEADER$namespace $NAMESPACE$ {
public class $CLASS$ : UnityEditor.ScriptableWizard
{
[UnityEditor.MenuItem("$MENUITEM$/$MENUITEMCOMMAND$")]
public static void CreateWizard()
{
DisplayWizard<$CLASS$>("$TITLE$", "$CREATE$", "$OTHER$");
}
public void OnWizardCreate()
{
$END$
}
public void OnWizardUpdate()
{
}
public void OnWizardOtherButton()
{
}
}
} Parameters
|
| Standard Surface Shader Scope Unity projects Body Shader "Custom/$NAME$" {
$END$Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
} Parameters
|
| Edit Mode Test Scope Unity Editor folder, Unity firstpass Editor folder Body $HEADER$using UnityEditor;
namespace $NAMESPACE$ {
public class $CLASS$ {
[NUnit.Framework.Test]
public void $CLASS$SimplePasses() {
// Use the Assert class to test conditions.
$END$
}
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityEngine.TestTools.UnityTest]
public System.Collections.IEnumerator $CLASS$WithEnumeratorPasses() {
// Use the Assert class to test conditions.
// yield to skip a frame
yield return null;
}
}
} Parameters
|
| Custom Editor Scope Unity Editor folder, Unity 2022.2 and later projects Body $HEADER$namespace $NAMESPACE$ {
[UnityEditor.CustomEditor(typeof($TYPE$))]
public class $CLASS$ : UnityEditor.Editor
{
public override UnityEngine.UIElements.VisualElement CreateInspectorGUI()
{
$END$
return base.CreateInspectorGUI();
}
}
} Parameters
|
| Unlit Shader Scope Unity projects Body Shader "Unlit/$NAME$"
{
$END$Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv);
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
} Parameters
|
| Scope Unity DOTS projects Body $HEADER$namespace $NAMESPACE$ {
public readonly partial struct $ASPECT$ : Unity.Entities.IAspect
{
$END$
}
} Parameters
|
| Editor Window (IMGUI) Scope Unity Editor folder, Unity 2022.1 and earlier projects Body $HEADER$namespace $NAMESPACE$ {
public class $CLASS$ : UnityEditor.EditorWindow
{
[UnityEditor.MenuItem("$MENUITEM$/$MENUITEMCOMMAND$")]
private static void ShowWindow()
{
var window = GetWindow<$CLASS$>();
window.titleContent = new UnityEngine.GUIContent("$TITLE$");
window.Show();
}
private void OnGUI()
{
$END$
}
}
} Parameters
|
| Scope Unity DOTS projects Body $HEADER$namespace $NAMESPACE$ {
public partial class $SYSTEM$ : Unity.Entities.SystemBase
{
protected override void OnUpdate()
{
$END$
}
}
} Parameters
|
| Authoring Mono Behaviour Scope Unity DOTS projects Body $HEADER$namespace $NAMESPACE$ {
public class $CLASS$ : UnityEngine.MonoBehaviour
{
private class $CLASS$Baker : Unity.Entities.Baker<$CLASS$>
{
public override void Bake($CLASS$ authoring)
{
}
}
}
} Parameters
|
| Property Drawer Scope Unity Editor folder, Unity 2022.2 and later projects Body $HEADER$namespace $NAMESPACE$ {
[UnityEditor.CustomPropertyDrawer(typeof($TYPE$))]
public class $CLASS$ : UnityEditor.PropertyDrawer
{
public override UnityEngine.UIElements.VisualElement CreatePropertyGUI(UnityEditor.SerializedProperty property)
{
$END$
return base.CreatePropertyGUI(property);
}
}
} Parameters
|