Unexpected symbol 'void' and Parsing error
Hello I am having trouble with a bit of code and void is underlined in red and I am getting the parsing error on unity console
void Start() Void Awake();
using UnityEngine;
using UnityEngine;
using System.Collections;
public class SCBlueButton : MonoBehaviour {
public void ModeSelect(){
StartCoroutine(LoadAfterDelay("8bitLifemenu"));
}}
IEnumerator LoadAfterDelay(string levelName){
yield return new WaitForSeconds(5);
Application.LoadLevel(8bitLifemenu);
}
Thanks for reading please reply as soon as possible
Answer by Pengocat · Jan 25, 2017 at 03:49 AM
The first line is two Monobehavior methods and they should not be outside the class block. The rest also the Coroutine LoadAfterDelay is placed outside the class Block. Finally Application.LoadLevel
is obsolete and you should use SceneManagement instead. This should work.
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class SCBlueButton : MonoBehaviour
{
public void ModeSelect()
{
StartCoroutine(LoadAfterDelay("8bitLifemenu"));
}
IEnumerator LoadAfterDelay(string levelName)
{
yield return new WaitForSeconds(5);
SceneManager.LoadScene(levelName);
}
}
Still getting the "Unexpected symbol 'void'" error but thanks
I do not need this anymore after downloading the beta
Your answer
Follow this Question
Related Questions
Please help! Public Void unexpected, school project! 1 Answer
I need someone to help me: error CS1525: Unexpected symbol `void' 0 Answers
Keyword 'void' cannot be used in this context, cant figure out what to do 1 Answer
Please Help "error CS1525: Unexpected symbol `void''' 1 Answer
Unexpected symbol `void' 1 Answer