Hey all. I'm getting these errors in my C Sharp script:
1) (10,25): error CS0103: The name `FindGameObjectsWithTag' does not exist in the current context
2) (11,17): error CS0103: The name `killerDoor' does not exist in the current context
3) (12,17): error CS0103: The name `killerDoor' does not exist in the current context
I'm trying to make it so this script decides from 4 doors the door that will kill the player when clicked at random. How can I fix this? The script:
using UnityEngine;
using System.Collections;
public class DoorManager: MonoBehaviour {
public GameObject [] doors;
void Start()
{
doors = FindGameObjectsWithTag( "door" );
killerDoor = doors [ Random.Range ( 0, doors.Length ) ];
killerDoor.GetComponent().killDoor = true;
}
}
↧