Skip to content

Instantly share code, notes, and snippets.

@jm
Created October 26, 2019 17:48
Show Gist options
  • Save jm/33f668b88ac7d3fc34577c931d83c5c0 to your computer and use it in GitHub Desktop.
Save jm/33f668b88ac7d3fc34577c931d83c5c0 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
using UnityEngine.Events;
[AddComponentMenu("Playground/Conditions/Condition Collision")]
[RequireComponent(typeof(Collider))]
public class ConditionCollision : ConditionBase
{
// This function will be called when something touches the trigger collider
void OnCollisionEnter(Collision collision)
{
if(collision.collider.CompareTag(filterTag)
|| !filterByTag)
{
ExecuteAllActions(collision.gameObject);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment