Skip to content

API and Customization

Emanuele Manzione edited this page Mar 23, 2022 · 3 revisions

For more advanced users that want to deeply customize the plugin, REPORTS offers multiple ways to expand the functionalities.

Graphics

It is simple to customize the appearance of REPORTS. Drag the ReportWidget prefab into your scene and customize it as you wish through the Unity UI.

Policies

REPORTS comes with an integrated Policy Loader that loads the policy from a text asset. You can implement your own loader by inheriting from PolicyLoaderBase and assigning it to the Loader field in the PolicyWidget component.

image

Take a look at the FilePolicyLoader script to get a rough idea of how to implement it.

By default, REPORTS checks if the policy has been accepted by saving data into the Unity PlayerPrefs storage. If you want to override this behaviour, just create a new class and inherit from PolicyCheckerBase. Assign the new created component to the Checker field in the PolicyWidget component.

image

Take a look at the PlayerPrefsPolicyChecker script to get a rough idea of how to implement it.

Screenshots

REPORTS comes with the integrated ability to collect screenshots from your game and include them in the report. By default, it uses the Unity API to capture screenshots. If you want to override this behaviour, just create a new class and inherit from ScreenshotTaker, then override the TakeScreenshot method. Then assign the new created component to the ScreenshotTakerWidget game object.

image

Collectors

Reports can be enriched with additional data by the Collectors. By default, REPORTS comes with the SystemInfoCollector, that collects system info and enrich the report by attaching them to the message.

To implement your own collectors, just create a new class and implement the IReportInfoCollector interface. Then add the initialization of your newly created collectors in the OnAwake method in the ReportCreatorWidget, by adding them in the Collectors list.

image

Take a look at the SystemInfoCollector script for reference.

Senders

In order to be useful, reports must be sent to someone that can process them. A web service, an email, a Trello card, etc: you name it. REPORTS comes with two integrated ways to send reports, but you can expand it to fit your needs. If you need to create a new sender, just create a new class and inherit from SenderBase. Then assign this new component to the Senders field in the ReportSenderWidget component. You can have multiple senders, if you desire: just add multiple entries to the Senders list.

image

Clone this wiki locally