Advertisement
JonneOpettaja

Sticky.cs

Feb 18th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1.  
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5.  
  6. public class Sticky : MonoBehaviour
  7. {
  8.     public GameObject Player;
  9.  
  10.     private void OnTriggerEnter(Collider other)
  11.     {
  12.         if (other.gameObject == Player)
  13.         {
  14.             Player.transform.parent = transform;
  15.         }
  16.     }
  17.  
  18.     private void OnTriggerExit(Collider other)
  19.     {
  20.         if (other.gameObject == Player)
  21.         {
  22.             Player.transform.parent = null;
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement