Save and try to build verse code. This will crash uefn.
Expected Result
It should produce an error instead. I assume it crashes because verse wants to be opinionated and doesn’t allow scripts that cross-reference each other.
Observed Result
It crashes uefn and can’t open the project until you comment out one of the references.
This bug is reported already and will be fixed in a future version I believe, you can look into this post if you want to Also a Workaround is for you to instead of having an editable of the device itself to have a creative_device and then inside the script to use it do
This technically isn’t a bug, it’s just a quirk of the language currently. When you create two verse devices that reference each other, it creates a circular dependency which is not allowed and will cause crashes.
The reason for this is when you write @editable TestSystem:test_system = test_system{} what you are actually doing is creating an instance of test_system and saving it to the TestSystem member. The problem is test_system requires an instance of test_manager and so it creates it and saves it to the TestManager member. But now the test_manager requires an instance of test_system and so on and so on… This will loop forever and is the reason for the crash.
Personally if I ever need two devices to have saved references for each other I will use optionals.
test_manager.verse
@editable
var TestSystemOP : ?test_system = false
test_system.verse
@editable
var TestManagerOP : ?test_manager = false
Optionals avoid this issue entirely and can still be set like any other editable member, but do need to be queried to get the value you want. You can get and set the value of optionals as shown below.
GetTestSystem():test_system=
if (TestSystem:= TestSystemOP?):
return TestSystem
else:
Print("Test System does not exist)
SetTestSystem(TestSystem:test_system):void=
set TestSystemOP = option {TestSystem}