Skip to main content
added 626 characters in body
Source Link
H. Pauwelyn
  • 815
  • 5
  • 17
  • 31

Update one: by a comment below I've made this code:

The Start() method is always called, no problems with it. But the Application.LoadLevel(...) code never executes when I click on the methods. However btnMenu and btnAgain aren't null.


Update two: I've upload a zip file on my SharePoint that you can access. Start a game and choose level 01. You navigating to a new scene. On that scene you have on the right below side you have two buttons, these are the buttons that doesn't work. If you can find the problem, please give me the solving of the problem. Other bug fixes are also welcome. 😉

Update: by a comment below I've made this code:

The Start() method is always called, no problems with it. But the Application.LoadLevel(...) code never executes when I click on the methods. However btnMenu and btnAgain aren't null.

Update one: by a comment below I've made this code:

The Start() method is always called, no problems with it. But the Application.LoadLevel(...) code never executes when I click on the methods. However btnMenu and btnAgain aren't null.


Update two: I've upload a zip file on my SharePoint that you can access. Start a game and choose level 01. You navigating to a new scene. On that scene you have on the right below side you have two buttons, these are the buttons that doesn't work. If you can find the problem, please give me the solving of the problem. Other bug fixes are also welcome. 😉

Click event don'tdoesn't trigger when clicking

I'llI've made some buttons on my screen to navigate to other scenes of my Unity project, but the Click(string command) methodemethod doesn't trigger. I've placed a breakpoint on the bold line in code below, but the pointer never hithits that point.

public class GameNavigation : MonoBehaviour
{
    public void Click(string command)
    {
        switch (command)
        {
            case "again":
                Application.LoadLevel(Application.loadedLevel);
                break;

            case "go_to_menu":
                Application.LoadLevel("Navigation");
                break;

            default:
                break;
        }
    }
}

Here are also some screenshots form my Unity project.

Inspector tools for navigation, btn again and event system and hierarchy

What did I wrong?


Note one: I've made also this code that is called after the scene ends. the parameter command is always an empty string.

public void RestartLevel(string command)
{
    switch (command)
    {
        case "again":
            Application.LoadLevel(Application.loadedLevel);
            break;

        case "go_to_menu":
            Application.LoadLevel("Navigation");
            break;

        default:
            break;
    }
}

If I place it in a comment, IveI get this error:

'Player' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?


Note two: I use also use a mouse down event for when the player must shoot.


Update: by a comment below I've made this code:

public Button btnAgain;
public Button btnMenu;

public void Start()
{
    btnAgain.onClick.AddListener(() => {
        Application.LoadLevel(Application.loadedLevel);
    });

    btnMenu.onClick.AddListener(() => {
        Application.LoadLevel("Navigation");
    });
}

The Start() methodemethod is always called, no problems whitwith it. But the Application.LoadLevel(...) code never executes when I click on the methodesmethods. However btnMenu and btnAgain aren't null.

Click event don't trigger when clicking

I'll made some buttons on my screen to navigate to other scenes of my Unity project, but the Click(string command) methode doesn't trigger. I've placed a breakpoint on the bold line in code below, but the pointer never hit that point.

public class GameNavigation : MonoBehaviour
{
    public void Click(string command)
    {
        switch (command)
        {
            case "again":
                Application.LoadLevel(Application.loadedLevel);
                break;

            case "go_to_menu":
                Application.LoadLevel("Navigation");
                break;

            default:
                break;
        }
    }
}

Here are also some screenshots form my Unity project.

Inspector tools for navigation, btn again and event system and hierarchy

What did I wrong?


Note one: I've made also this code that is called after the scene ends. the parameter command is always an empty string.

public void RestartLevel(string command)
{
    switch (command)
    {
        case "again":
            Application.LoadLevel(Application.loadedLevel);
            break;

        case "go_to_menu":
            Application.LoadLevel("Navigation");
            break;

        default:
            break;
    }
}

If I place it in comment, Ive this error:

'Player' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?


Note two: I use also a mouse down event for when the player must shoot.


Update: by a comment below I've made this code:

public Button btnAgain;
public Button btnMenu;

public void Start()
{
    btnAgain.onClick.AddListener(() => {
        Application.LoadLevel(Application.loadedLevel);
    });

    btnMenu.onClick.AddListener(() => {
        Application.LoadLevel("Navigation");
    });
}

The Start() methode is always called, no problems whit it. But the Application.LoadLevel(...) code never executes when I click on the methodes. However btnMenu and btnAgain aren't null.

Click event doesn't trigger when clicking

I've made some buttons on my screen to navigate to other scenes of my Unity project but the Click(string command) method doesn't trigger. I've placed a breakpoint on the bold line in code below, but the pointer never hits that point.

public class GameNavigation : MonoBehaviour
{
    public void Click(string command)
    {
        switch (command)
        {
            case "again":
                Application.LoadLevel(Application.loadedLevel);
                break;

            case "go_to_menu":
                Application.LoadLevel("Navigation");
                break;

            default:
                break;
        }
    }
}

Here are also some screenshots form my Unity project.

Inspector tools for navigation, btn again and event system and hierarchy

What did I wrong?


Note one: I've made also this code that is called after the scene ends. the parameter command is always an empty string.

public void RestartLevel(string command)
{
    switch (command)
    {
        case "again":
            Application.LoadLevel(Application.loadedLevel);
            break;

        case "go_to_menu":
            Application.LoadLevel("Navigation");
            break;

        default:
            break;
    }
}

If I place it in a comment, I get this error:

'Player' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?


Note two: I also use a mouse down event for when the player must shoot.


Update: by a comment below I've made this code:

public Button btnAgain;
public Button btnMenu;

public void Start()
{
    btnAgain.onClick.AddListener(() => {
        Application.LoadLevel(Application.loadedLevel);
    });

    btnMenu.onClick.AddListener(() => {
        Application.LoadLevel("Navigation");
    });
}

The Start() method is always called, no problems with it. But the Application.LoadLevel(...) code never executes when I click on the methods. However btnMenu and btnAgain aren't null.

added 599 characters in body
Source Link
H. Pauwelyn
  • 815
  • 5
  • 17
  • 31

I'll made some buttons on my screen to navigate to other scenes of my Unity project, but the Click(string command) methode doesn't trigger. I've placed a breakpoint on the bold line in code below, but the pointer never hit that point.

public class GameNavigation : MonoBehaviour
{
    public void Click(string command)
    {
        switch (command)
        {
            case "again":
                Application.LoadLevel(Application.loadedLevel);
                break;

            case "go_to_menu":
                Application.LoadLevel("Navigation");
                break;

            default:
                break;
        }
    }
}

Here are also some screenshots form my Unity project.

Inspector tools for navigation, btn again and event system and hierarchy

What did I wrong?


Note one: I've made also this code that is called after the scene ends. the parameter command is always an empty string.

public void RestartLevel(string command)
{
    switch (command)
    {
        case "again":
            Application.LoadLevel(Application.loadedLevel);
            break;

        case "go_to_menu":
            Application.LoadLevel("Navigation");
            break;

        default:
            break;
    }
}

If I place it in comment, Ive this error:

'Player' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?


Note two: I use also a mouse down event for when the player must shoot.


Update: by a comment below I've made this code:

public Button btnAgain;
public Button btnMenu;

public void Start()
{
    btnAgain.onClick.AddListener(() => {
        Application.LoadLevel(Application.loadedLevel);
    });

    btnMenu.onClick.AddListener(() => {
        Application.LoadLevel("Navigation");
    });
}

The Start() methode is always called, no problems whit it. But the Application.LoadLevel(...) code never executes when I click on the methodes. However btnMenu and btnAgain aren't null.

I'll made some buttons on my screen to navigate to other scenes of my Unity project, but the Click(string command) methode doesn't trigger. I've placed a breakpoint on the bold line in code below, but the pointer never hit that point.

public class GameNavigation : MonoBehaviour
{
    public void Click(string command)
    {
        switch (command)
        {
            case "again":
                Application.LoadLevel(Application.loadedLevel);
                break;

            case "go_to_menu":
                Application.LoadLevel("Navigation");
                break;

            default:
                break;
        }
    }
}

Here are also some screenshots form my Unity project.

Inspector tools for navigation, btn again and event system and hierarchy

What did I wrong?


Note one: I've made also this code that is called after the scene ends. the parameter command is always an empty string.

public void RestartLevel(string command)
{
    switch (command)
    {
        case "again":
            Application.LoadLevel(Application.loadedLevel);
            break;

        case "go_to_menu":
            Application.LoadLevel("Navigation");
            break;

        default:
            break;
    }
}

If I place it in comment, Ive this error:

'Player' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?


Note two: I use also a mouse down event for when the player must shoot.

I'll made some buttons on my screen to navigate to other scenes of my Unity project, but the Click(string command) methode doesn't trigger. I've placed a breakpoint on the bold line in code below, but the pointer never hit that point.

public class GameNavigation : MonoBehaviour
{
    public void Click(string command)
    {
        switch (command)
        {
            case "again":
                Application.LoadLevel(Application.loadedLevel);
                break;

            case "go_to_menu":
                Application.LoadLevel("Navigation");
                break;

            default:
                break;
        }
    }
}

Here are also some screenshots form my Unity project.

Inspector tools for navigation, btn again and event system and hierarchy

What did I wrong?


Note one: I've made also this code that is called after the scene ends. the parameter command is always an empty string.

public void RestartLevel(string command)
{
    switch (command)
    {
        case "again":
            Application.LoadLevel(Application.loadedLevel);
            break;

        case "go_to_menu":
            Application.LoadLevel("Navigation");
            break;

        default:
            break;
    }
}

If I place it in comment, Ive this error:

'Player' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?


Note two: I use also a mouse down event for when the player must shoot.


Update: by a comment below I've made this code:

public Button btnAgain;
public Button btnMenu;

public void Start()
{
    btnAgain.onClick.AddListener(() => {
        Application.LoadLevel(Application.loadedLevel);
    });

    btnMenu.onClick.AddListener(() => {
        Application.LoadLevel("Navigation");
    });
}

The Start() methode is always called, no problems whit it. But the Application.LoadLevel(...) code never executes when I click on the methodes. However btnMenu and btnAgain aren't null.

Source Link
H. Pauwelyn
  • 815
  • 5
  • 17
  • 31
Loading