I’m getting the error:
Assets/LeftDoorOpen_Close.cs(31,28): error CS1061: Type object' does not contain a definition for
gameObject’ and no extension method gameObject' of type
object’ could be found. Are you missing an assembly reference?
What do I do? Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LeftDoorOpen_Close : MonoBehaviour {
Animator animator;
bool doorOpen;
public object LeftDoorKeyPad { get; private set; }
void Start()
{
doorOpen = false;
animator = GetComponent<Animator>();
}
void OnTriggerStay(Collider LeftDoorKeyPad)
{
if(LeftDoorKeyPad.gameObject.tag == "Player")
{
if (Input.GetKey(KeyCode.X))
{
doorOpen = true;
DropshipLeftDoor("Open");
}
}
}
void OnTriggerExit(Collider LeftDoorKeypad)
{
if (LeftDoorKeyPad.gameObject.tag == "Player") // <-- It's referring to this line.
{
if (Input.GetKey(KeyCode.X))
{
if (doorOpen)
{
doorOpen = false;
DropshipLeftDoor("Close");
}
}
}
}
void DropshipLeftDoor(string direction)
{
animator.SetTrigger(direction);
}
}
Sorry if this is a total noob question but I’m a beginner.