Awake is called when the script instance is being loaded.
private var target : GameObject; function Awake () { target = GameObject.FindWithTag ("Player"); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { private GameObject target; void Awake() { target = GameObject.FindWithTag("Player"); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): private target as GameObject def Awake() as void: target = GameObject.FindWithTag('Player')