Why error unexpected symbol `_timeout`

using UnityEngine;
using System.Collections;
public class Door : MonoBehaviour {
public bool open;
private float _timeout;
public float Timeout;
private GameObject player;
public float MaxDistance = 3;
// Use this for initialization
void Start ()

{
player = GameObject.FindGameObjectWithTag("Player");
}
// Update is called once per frame
void Update ()
{
_timeout += Time.deltaTime;
if(Input.GetKeyDown(KeyCode.E)&_timeout>Timeout&Vector3.Distance(player.transform.position, transform.position) 
  { 
_timeout = 0;
open = !open;
if(open == true)
{
transform.animation.CrossFade("open");
}
if(open == false)
{
transform.animation.CrossFade("Close");
}
}
}
}

Hi

Please tell us what line the error is in.
I guess its here:

if(Input.GetKeyDown(KeyCode.E)&_timeout>Timeout&Vector3.Distance(player.transform.position, transform.position)

type this instead:

if(Input.GetKeyDown(KeyCode.E) && _timeout>Timeout && Vector3.Distance(player.transform.position, transform.position))

logic AND is &&

you also forgot the bracket

however this if statement probably wont work at all.

Vector3.Distance() returns a float which cannot be compared to a bool.

you probably want to compare this too, something like:

if(Input.GetKeyDown(KeyCode.E) && _timeout>Timeout && Vector3.Distance(player.transform.position, transform.position) > 100)

Please also format your code properly next time :slight_smile:

20.8 symbol_timeour