Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using UnityEngine.AI;
public enum EnemyState
{
Chase,
Attack
}
public sealed class EnemyData : MonoBehaviour
private WaitForSeconds _delay = new WaitForSeconds(5f);
private IEnumerator WaitCo()
{
while (!animationFinished)
{
yield return delay;
}
}
private readonly List<Enemies> _enemiesToCheck = new List<Enemies>();
private void Update()
{
_enemiesToCheck.Clear();
EnemyLogic(_enemiesToCheck);
}
private Vector3 _prevPos;
private void Update()
{
if (transform.position != _prevPos)
{
VeryExpensiveFunction(transform.Position);
_prevPos = transform.postion;
}
}
private void Update()
{
VeryExpensiveGarbageGeneratingFunction(transform.position);
}
int count = _array.Length;
for (int i = 0; i < count; ++i)
{
    //DO SOME WORK HERE
}
private BoxCollider[] _allColliders;
private void Start()
{
_allColliders = FindObjectsOfType<BoxCollider>();
}
private void OnTriggerEnter(Collider other)
{
private void OnTriggerEnter()
{
var allColliders = FindObjectsOfType<BoxCollider>();
DoAThing(allColliders);
}
@lindsaygcox
lindsaygcox / CustomRenderPassFeature.cs
Created June 19, 2019 09:51 — forked from phi-lira/CustomRenderPassFeature.cs
Custom Render Feature script template to be added to a LWRP Renderer. Drag 'n Drop this script to your project, write the desired rendering code. It now it's available to be added to a LWRP renderer by clicking on the + icon under renderer features in the Renderer inspector.
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.LWRP;
public class CustomRenderPassFeature : ScriptableRendererFeature
{
class CustomRenderPass : ScriptableRenderPass
{
// This method is called before executing the render pass.
// It can be used to configure render targets and their clear state. Also to create temporary render target textures.
Shader "Custom/Sprite_Dithered"
{
Properties
{
[PerRendererData]
_MainTex("Texture", 2D) = "white" {}
_Color("Color", Color) = (1, 1, 1, 1)
}
SubShader