void Awake(){ gameObject.name = gameObject.name.Replace("(Clone)", ""); Player = GameObject.FindWithTag("Player").transform; hcs = Player.GetComponent<HeroControllerScript>(); inv = Player.GetComponent<Inventory>(); ItemObject = Resources.Load(gameObject.name) as GameObject; }
private HeroControllerScript playerControl; // Reference to the PlayerControl script. #endregion Fields #region Methods void Awake() { // Setting up references. playerControl = GetComponent<HeroControllerScript>(); audioSource = GetComponent<AudioSource>(); }
private HeroControllerScript playerCtrl; // Reference to the PlayerControl script. #endregion Fields #region Methods void Awake() { // Setting up the references. anim = transform.root.gameObject.GetComponent<Animator>(); playerCtrl = transform.root.GetComponent<HeroControllerScript>(); }
// Use this for initialization void Start () { anim = GetComponent<Animator>(); player = GameObject.FindGameObjectWithTag("Player"); hcs = player.GetComponent<HeroControllerScript>(); }
void Start(){ hcs = gameObject.GetComponent<HeroControllerScript>(); }