Unexpected Symbol?
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class UIScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Pause")) {
UIBehaviour() pause = new UIBehaviour().Pause();
}
}
}
public class UIBehaviour() : MonoBehaviour {
public void Pause() {
Time.timescale = 0;
}
public void Resume() {
Time.timescale = 1;
}
}
I'm getting many errors, the first being "Unexpected Symbol 'pause'" when I try and call the function.
Removing pause before I call a new UIBehaviour returns this error: Assets/UIScript.cs(20,25): error CS1644: Feature `primary constructor' cannot be used because it is not part of the C# 4.0 language specification
Can someone point me in the right direction? I think I'm doing something quite wrong.
Comment