Invoke isn’t working and it’s bringing up the following 2 errors:
Assets/WelcomeMessage.cs(17,10): error CS1525: Unexpected symbol `disableCanvas’
and
Assets/WelcomeMessage.cs(17,2): error CS1520: Class, struct, or interface method must have a return type
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class WelcomeMessage : MonoBehaviour {
public string myMessage = "Welcome!";
public Text welcomeText;
public GameObject canvasWelcome;
// Use this for initialization
void Start () {
MyWelcomeMessage();
}
Invoke("disableCanvas", 3);
void MyWelcomeMessage()
{
if (welcomeText != null) {
welcomeText.text = myMessage;
} else {
Debug.LogWarning ("welcomeText is not assigned!");
}
}
void disableCanvas()
{
canvasWelcome.SetActive (false);
}
}
Any help would be greatly appreciated. Thanks!