Skip to content

Instantly share code, notes, and snippets.

@jm
Created October 26, 2019 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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