Now the weirdest thing is happening. Where do I start...
The game used to run for a while before crashing (if at all crashing) but now it can't even emit a single note node, it just hangs, all without changing a single line of code. This happens within the editor AND with packaged .exe game outside of the editor (that worked on the same computer before!).
When trying to narrow down where exactly it hangs, it appears that it can't instance new nodes of any type EXCEPT for the root Node type. The stripped code is something like this:
in Main.gd:
func _ready():
OS.open_midi_inputs()
func _unhandled_input(event : InputEvent):
if (event is InputEventMIDI):
match event.message:
MidiMessageType.MIDI_MESSAGE_NOTE_ON:
emit_signal("key_on", event.pitch - 21, event.velocity)
MidiMessageType.MIDI_MESSAGE_NOTE_OFF:
emit_signal("key_off", event.pitch - 21)
In NoteLane.gd (child node of Main/PianoRoll):
extends Control
onready var note_rect = preload("res://PianoRoll/Note.tscn")
func _ready():
var _err1 = get_node("/root/Main").connect("key_on", self, "_on_key_on")
var _err2 = get_node("/root/Main").connect("key_off", self, "_on_key_off")
func _on_key_on(note, velocity):
if note == midi_note:
var new_note = note_rect.instance()
func _on_key_off(note):
if note == midi_note:
.....
So, in onkey_on() triggered by MIDI event doing note_rect.instance() hangs the game. If I swap this specific scene for any generic node type it hangs the game, i.e. Node2D.instance(). The only node that doesn't hang the game is Node.instance(). (but that's useless for my purposes).
The weirdest things are:
1) This code WORKED on muptiple computers before. Nothing was changed, no Godot version update, no Windows updates, no changes to anything whatsoever, now the game hangs in that spot with no error/debug messages.. ((
2) If instead of signals being emitted by MIDI events in Main.gd I use a key from the input map (i.e. "K") everything WORKS as expected, the nodes are being instanced in onkey_on() inside NoteLane.gd without changing any code anywhere.
Restarts of the computer don't help. Windows 10 x64 1903...