r/Unity3D•
Rufal04

help with c sharp

Question

im new and trying to learn c sharp. what is wrong with this code?(its prob something super obvios but still)

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class Trigger : MonoBehaviour {

public GameObject cubeObject;
public GameObject UI

void Start()
{
    cubeObject.SetActive(false);
    UI.SetActive(false);
}

void OnTriggerEnter(Collider other)
{
    if (other.CompareTag("Player"))
        cubeObject.SetActive(true);
    UI.SetActive(true);

    if (other.CompareTag("player"))  {
        Input.GetKeyDown("E")

}

    {
        Debug.Log("HEY");
    }
}

void OnTriggerExit(Collider other)
{
    if (other.CompareTag("Player"))
        cubeObject.SetActive(false);
    UI.SetActive(false);
}

}

edit: this is the error message: Assets/Trigger.cs(11,8): error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration

Posted Aug 25, 2017, 1:07 PM UTC · edited

09
Loading comments…