This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using static UnityEngine.Debug; | |
[ExecuteInEditMode] | |
[RequireComponent(typeof(MeshFilter))] | |
public class DrawTriangleNormals : MonoBehaviour | |
{ | |
private Mesh _mesh; | |
private MeshFilter _meshFilter; | |
public Color _rayColor = Color.cyan; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[RequireComponent(typeof(Rigidbody2D))] | |
public class PlayerController : MonoBehaviour | |
{ | |
private const float WALK_SPEED = 2; | |
private const float JUMP_FORCE = 250; | |
private Vector2 _jumpVector; | |
private bool _queueJump; | |
private bool _queueWalkLeft; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Managed\UnityEngine\Unity.Cecil.dll" | |
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Managed\UnityEngine\Unity.Cecil.Mdb.dll" | |
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Managed\UnityEngine\Unity.Cecil.Pdb.dll" | |
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Managed\UnityEngine\Unity.Legacy.NRefactory.dll" | |
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Managed\UnityEngine\UnityEditor.dll" | |
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Managed\UnityEngine\UnityEngine.AccessibilityModule.dll" | |
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Managed\UnityEngine\UnityEngine.AIModule.dll" | |
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Managed\UnityEngine\UnityEngine.AndroidJNIModule.dll" | |
#r "C:\Program Files\Unity\Hub\Editor\{UNITY_VERSION_NUMBER}\Editor\Data\Manag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
target = (TargetType) o; | |
} | |
catch (InvalidCastException) | |
{ | |
// Handle exception | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Child | |
{ | |
// Stuff | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Casting | |
{ | |
private Child _child; | |
private Parent _parent; | |
[GlobalSetup] | |
public void GlobalSetup() | |
{ | |
_parent = new Parent(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IL_0000: ldarg.0 | |
IL_0001: ldfld class BanksySan.Blog.Performance.Child BanksySan.Blog.Performance.Casting::_child | |
IL_0006: castclass BanksySan.Blog.Performance.Parent | |
IL_000b: ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using static UnityEditor.Handles; | |
using static UnityEngine.Color; | |
using static UnityEngine.Gizmos; | |
[ExecuteAlways] | |
[RequireComponent(typeof(Renderer))] | |
public class MarkCenterAndExtents : MonoBehaviour | |
{ | |
private const float RADIUS = 0.02f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"com.unity.2d.animation": "3.2.1", | |
"com.unity.2d.pixel-perfect": "2.0.4", | |
"com.unity.2d.sprite": "1.0.0", | |
"com.unity.2d.spriteshape": "3.0.10", | |
"com.unity.2d.tilemap": "1.0.0", | |
"com.unity.cinemachine": "2.5.0", | |
"com.unity.ide.rider": "1.1.4", | |
"com.unity.progrids": "3.0.3-preview.6", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using static UnityEditor.Handles; | |
using static UnityEngine.Color; | |
using static UnityEngine.Gizmos; | |
[ExecuteAlways] | |
[RequireComponent(typeof(Renderer))] | |
public class MarkCenterAndExtents : MonoBehaviour | |
{ | |
private const float RADIUS = 0.02f; |