Variable default values

When you create a global or scene variable, you can specify a default value. I find this helpful because it means my variables have values already so I can preview my game from any scene and it works (as opposed to starting from the beginning each time just so the appropriate variables get set).

However it’s not so good for readability. Not only is it confusing to look at an events sheet and wonder how/where a variable is set, but even if you assume it has a default value, you don’t know what that is.

For better readability, I wonder if it’d be worth automatically creating read-only actions in the ‘At the beginning of the scene’ event that sets the default value of any variables? Either that or making it a normal action that can be edited, and if you edit it then it automatically updates the default value in the global/scene variables section.

Thoughts?

I can’t find the thread anymore, but there was a discussion on something similar a few years back, and there is pretty explicit intent to never automatically add anything to the event sheet for numerous reasons:

  1. If it’s in the event sheet and enabled, it’s in the final export file, so you’re bloating final output filesize.
  2. If it’s in the event sheet, there is no way to make it “placeholder”/read-only without restructuring how the event sheet works.

If a dev has a different view on this nowadays they may chime in.

That said, if you’re just needing to see what a value is, you don’t have to go anywhere from the events. In the event sheet, when you need to see the value of a scene/object/global variable for an event, or for an expression, there is a built in way to view the current values of that value type. Ensure you have the event open, and just click on the arrow button to the right.
image

You can not only define new variables here, it’ll show you all variables that exist for that type.

1 Like