Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MidiJack not working after scene change #13

Open
alanpq opened this issue Jan 5, 2017 · 6 comments
Open

MidiJack not working after scene change #13

alanpq opened this issue Jan 5, 2017 · 6 comments
Assignees
Labels

Comments

@alanpq
Copy link

alanpq commented Jan 5, 2017

Whenever I try to use SceneManager.LoadScene(), and then in the new scene try using MidiMaster.GetKeyDown(), nothing happens. There are no errors of any kind, and no logs. Do I need to re-initialise it somehow?

@keijiro keijiro self-assigned this Jan 6, 2017
@keijiro keijiro added the bug label Jan 6, 2017
@mrjdbruce
Copy link

is there any update on this issue? I'm having the same issue.

@keijiro
Copy link
Owner

keijiro commented Mar 5, 2017

I can't reproduce the issue. Could you provide a minimum project that reproduces the issue?

@alanpq
Copy link
Author

alanpq commented Mar 5, 2017

Ok, it turns out that the issue only happens when you check for midi input and switch scenes in the same method (I think?). Here is a project with the issue: https://github.com/cakyman/MidiJackIssue

@keijiro
Copy link
Owner

keijiro commented Mar 6, 2017

Thanks for providing the project. I'll look into it later.

@cansik
Copy link

cansik commented Apr 24, 2017

I have the same issue with version v5.6.

Just checking for key input. After one scene restart, the Midi Key won't be clicked anymore.

if (MidiMaster.GetKeyDown(noteNumber))
    StartGame();

@cansik
Copy link

cansik commented Apr 24, 2017

You are keeping the MIDI Updater object alive:

public static void CreateGameObject(Callback callback)
{
    var go = new GameObject("MIDI Updater");

    // this is the line which causes the problem!
    GameObject.DontDestroyOnLoad(go);

    go.hideFlags = HideFlags.HideInHierarchy;

    var updater = go.AddComponent<MidiStateUpdater>();
    updater._callback = callback;
}

If you uncomment this line, the midi updater will work after changing the scene!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants