Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Need help with c# script!

$
0
0
So i am developing a parkour game.
I need a script which i can use to detect the closest object to the player with the "parkourable" tag
Here is my code:

Code (CSharp):
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Vault : MonoBehaviour {
  5.     private float distance;
  6.     public GameObject closest;
  7.     private GameObject gos;
  8.     private GameObject closestObject;
  9.  
  10. void Awake(){
  11.     InvokeRepeating("FindClosestObject", 0.5f,0.5f);
  12. }
  13. GameObject FindClosestObject() {
  14.     gos =...
Need help with c# script!

Viewing all articles
Browse latest Browse all 1466670