Hiya,
How can a script access the gravity_y property in Project Settings? I’m using sys.get_config("display.width")
elsewhere and it works, but sys.get_config("physics.gravity_y")
and sys.get_config("physics.gravity")
return nil
. Are they inaccessible?
sys.get_config("physics.gravity_y")
is correct, but if you haven’t changed from the default value then the game.project file will actually not have an entry for gravity_y
and sys.get_config()
will return nil for that property.
I believe this is a difference between Editor 1 and Editor 2 and I’m not sure if the editor team is aware of it? Ping @Erik_Angelin, @mats.gisselson and @Ragnar_Dahlen
I take this back. Editor 1 behaves the same way.
@neonb: The solution is to actually enter a value in game.project or use sys.get_config("key", default_value)
Allright, thanks! I changed the value a bit from the default and now it works. Would it be possible for the editor to write out all default values to the project file when creating a new project, if just for making them accessible right away? Should I post this to the feature request section?
Yes please.