using UnityEngine; using System.Collections; public class MagnetEffect : MonoBehaviour { public GameObject magnetTipObject; // Object for placing Magnet Ray // SELF-NOTE: You will need to connect this script to the player controls // in order to make use of the ShootRay() function. // Use this for initialization void Start () { } // Update is called once per frame void Update () { } // FUNCTION: Shoot Magnet Ray void ShootRay(){ RaycastHit hit; if(Physics.Raycast(magnetTipObject.transform.position, magnetTipObject.transform.forward, out hit)){ if(hit.collider.tag == "moveable"){ print ("Magnet Laser hit the object : " + hit.collider.gameObject.name); } } } }