-
Notifications
You must be signed in to change notification settings - Fork 1
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
Argument Null Exception on startup #19
Comments
I tried to track down what causes the ids to be set to null by debugging, but I can't figure it out. Nothing seems to change the ids or replace the switches in the array on the MPF game logic engine, they're just null as soon as the game starts |
I found the problem. This commit in the main VPE repository changed the access specifier of the switch, coil and lamp IDs from public to private. This causes Unity to no longer serialize their values. From the Unity documentation:
I can think of the following options to fix this:
I think the downsides of the last option are the least severe. On top of this, when the machine description is updated via the inspector, the Unity Editor must be notified of the changes for them to be saved with the scene. I have created pull request #20 in this repository and this pull request in the main VPE repository to implement the proposed changes and solve this issue. |
Thanks for this very detailed report and the PR. Getting slowly back into VPE, and your reflections make sense. |
When starting the table in the editor with an
MpfGameLogicEngine
component containing a valid machine description attached, theOnInit
function inMpfGameLogicEngine.cs
throws the following exception:The
Id
property of all switches, coils and lights, is set to null when the game is started. This is also visible in the Inspector.Before clicking play:
After clicking play:
I am using:
The text was updated successfully, but these errors were encountered: