|
1 | | -raygun4unity |
| 1 | +Raygun4Unity |
2 | 2 | ============ |
3 | 3 |
|
4 | | -Raygun.io support for Unity 3D |
| 4 | +Where is my app API key? |
| 5 | +==================== |
| 6 | + |
| 7 | +When sending exceptions to the Raygun.io service, an app API key is required to map the messages to your application. |
| 8 | + |
| 9 | +When you create a new application on your Raygun.io dashboard, your app API key is displayed at the top of the instructions page. You can also find the API key by clicking the "Application Settings" button in the side bar of the Raygun.io dashboard. |
| 10 | + |
| 11 | +Namespace |
| 12 | +==================== |
| 13 | +The main classes can be found in the Mindscape.Raygun4Unity namespace. |
| 14 | + |
| 15 | +Usage |
| 16 | +==================== |
| 17 | + |
| 18 | +Raygun4Unity can be used in two main ways: automatically, and manually. |
| 19 | + |
| 20 | +####Automatically |
| 21 | + |
| 22 | +You can setup Raygun4Unity to automatically send all unhandled exceptions with the following single line of code. This code should be placed in a C# script file that will be called in the initialization process of the game. |
| 23 | + |
| 24 | +``` |
| 25 | +RaygunClient.Attach("YOUR_APP_API_KEY"); |
| 26 | +``` |
| 27 | + |
| 28 | +####Manually |
| 29 | + |
| 30 | +If you already have your own centralized logging system in place, then you many want to send messages to Raygun.io manually within your logging handlers. |
| 31 | +This can be done by createing a new instance of RaygunClient and using one of the Send method overloads. There are 3 different types of data that you can use in the Send methods: |
| 32 | + |
| 33 | +* **Strings** provided by Unity for the error message and stack trace. |
| 34 | +* **Exception** .Net objects. Useful if you need to send handled exceptions in try/catch blocks. |
| 35 | +* **RaygunMessage** Allowing you to fully specify all the data fields that get sent to Raygun.io |
| 36 | + |
| 37 | +``` |
| 38 | +RaygunClient client = new RaygunClient("YOUR_APP_API_KEY"); |
| 39 | +client.Send(e); |
| 40 | +``` |
| 41 | + |
| 42 | +Options |
| 43 | +==================== |
| 44 | + |
| 45 | +####Application version |
| 46 | + |
| 47 | +The current version of Raygun4Unity does not automatically obtain the application version number. You can however specify this by setting the ApplicationVersion property of the RaygunClient instance. |
| 48 | +If you are using the Attach method, you can get the RaygunClient instance from the static RaygunClient.Current property. |
| 49 | + |
| 50 | +####User |
| 51 | + |
| 52 | +To keep track of how many users are affected by each exception, you can set the User property of the RaygunClient instance. This can be any id string of your choosing to identify each user. |
| 53 | +Ideally, try to use an id that you can use to relate back to an actual user such as a database id, or an email address. If you use an email address, the users gravitars (if found) will displayed on the Raygun.io error dashboards. |
| 54 | + |
| 55 | +####Tags and custom data |
| 56 | + |
| 57 | +The Send method overloads allow you to send an optional list of tags or a dictionary of object data. You can use these to provide whatever additional information you want to help you debug exceptions. |
0 commit comments