Skip to main content

Runtime Analysis

What is Runtime Analysis?#

Runtime Analysis is a feature of Luna Playable that excludes unused classes or methods from your playable build in order to save space, whilst also eliminating the time needed to manually exclude these yourself.

This includes both user methods and classes, as well as those from within our engine that aren't being used.

To achieve this, upon running Runtime Analysis we detect all c# classes, their methods and properties. We mark each class, method and property as “unused” and place a hook inside them. Each time a class, method or property is used, our hook is fired and and we mark this component as “used”. We’re constantly updating this exclusion list as the game is played, and this list will become smaller and smaller as new classes and methods are used during playthroughs. This exclusion list is shown in the Runtime Analysis tab.

Scripts exclusions and Runtime Analysis are not connected with each other. Excluded scripts will not be included in the playable build used during Runtime Analysis.

You will need to playthrough your game enough times that you go through most possible interactions. This will allow Runtime Analysis to have a comprehensive idea of what methods/classes are needed, and in doing so will avoid errors in your build.

From testing this feature on a number of projects, we have found that Runtime Analysis reduces the size of the playable code by ~30%!

This means you have more space for features and improved game art, which can drive engagement and experience.

As this process is automated you may encounter build issues if the wrong script is marked for exclusion. If so, you can check the list of excluded code in the Runtime Analysis tab within the Code section of the plugin window, and untick any methods/classes that are needed.

Where to find Runtime Analysis#

Runtime Analysis can be found by navigating to the Code section of the Playable Plugin window, and then by clicking on the "Runtime Analysis" tab.

images-medium

You can also navigate to this tab from within the Size Optimisation tab, by clicking on the "Optimize Scripts" button.

images-medium

How to use Runtime Analysis#

Starting Runtime Analysis#

In order to start Runtime Analysis, first navigate to it within Luna Playable.

After doing so click on the "Start Analysis" button. This will go about building the game and checking the selected scene(s).

images-medium

When this process has completed, a pop-up window will appear asking you to run the playable in the browser.

images-small

This is an important step in the analysis, as your playthrough will highlight any methods/classes that were missed out as 'needed' when the initial scan of your scene(s) was done.

In order to create an accurate exclusion list, you will need to refresh and playthrough as many aspects/interactions of your game as possible. This will allow Runtime Analysis to build a comprehensive list of methods/classes to not exclude from the build, and will avoid errors occurring.

The build that opens at the end of Runtime Analysis is a unique build that detects unused methods/classes. Future develop builds will allow Playable to re-include methods/classes that were previously marked as unused if their use is detected in future builds, but will not add more methods/classes to the exclusion list. To do so you will need to run Runtime Analysis again.

Undoing Exclusions#

If you have found that Runtime Analysis has marked a script you need for exclusion, you can untick said script from with the Excluded Code list:

images-large

Alternatively, if you would like to undo all exclusions made by Runtime Analysis you can simply click on the 'Reset' button:

images-medium

When to use Runtime Analysis?#

It is best to use Runtime Analysis just before uploading to Playground, or when in the process of optimizing for size.

If you use Runtime Analysis early on in your development process, the list of excluded methods/classes will not be added to unless you run it again.