Skip to content

Instantly share code, notes, and snippets.

View mandarinx's full-sized avatar

Thomas Viktil mandarinx

View GitHub Profile
using UnityEngine;
using System.Collections;
using UnityEngine.Events;
namespace Cluster {
public class CollisionCall : MonoBehaviour {
public LayerMask layerMask = -1;
@mandarinx
mandarinx / GearRotator.cs
Last active August 29, 2015 14:28 — forked from LordNed/GearRotator.cs
A quick example of creating a gear or object that can spin with mouse cursor. Expects object to rotate along its Forward vector.
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
public class GearRotator : MonoBehaviour
{
[SerializeField] private float m_radiusThreshold = 4f;
private float m_startingAngle;
private Quaternion m_startingRotation;
// You can switch to a regular Update() loop
// if you comment out this line. (makes debugging easier)
#define COROUTINE
//
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using UnityEngine;
using Debug = UnityEngine.Debug;
#if UNITY_EDITOR
void SingleComponentCheck() {
var components = gameObject.GetComponents(this.GetType());
foreach (var component in components) {
if (component == this) continue;
UnityEditor.EditorUtility.DisplayDialog("Can't add the same component multiple times!",
string.Format("The component {0} can't be added because {1} already contains the same component.", this.GetType(), gameObject.name),
"Cancel");