Hey Developers,
Today we have enabled some flags in the game engine to print when you require a MainModule script asset by id in-game. This is a simple tool to help you gain an understanding about script modules included in your game and debug where they are coming from in Studio and Game.
In an effort to not be too noisy, these will happen once per require
and show you the call stack where the require happens.
Here’s a quick demo screenshot of what this looks like in Studio:
To understand what’s happening in this example above, it’s nice to know that the source code to asset 7881329664 is:
return require(7883454528)
and the source code to asset 7883454528 is:
print("This is a dummy require. Callstack is:")
print(debug.traceback())
return {}
As you can see, these generate console messages showing you what is required and where it was required.
Here’s a quick demo screenshot of what this same game produces on the server console when published and running as a developer in the game client:
In addition to printing the location, for additional transparency in finding errors coming from these modules, we have renamed the root to required_asset_#
. You can see this in the screenshots above.
As some people use require to hide malicious logic in games or load exploits, we hope this introspection enables you to do more to keep your game safe. We are working to do more in this space and pay attention to your feedback.
-Mr_Purrsalot