You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-23Lines changed: 29 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,50 +28,56 @@ The main classes can be found in the Mindscape.Raygun4Unity namespace.
28
28
Usage
29
29
====================
30
30
31
-
Raygun4Unity can be used in two main ways: automatically, and manually.
32
-
33
-
####Automatically
34
-
35
-
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.
36
-
37
-
```
38
-
RaygunClient.Attach("YOUR_APP_API_KEY");
39
-
```
40
-
41
-
**WARNING** The RaygunClient uses Application.RegisterLogCallback to listen to exceptions. RegisterLogCallback can only have one handler at a time, so if you already are using RegisterLogCallback,
42
-
then you'll want to send the exception information manually within your existing callback.
43
-
44
-
####Manually
45
-
46
-
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.
47
-
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:
31
+
To send exception messages to your Raygun.io dashboard, create an instance of the RaygunClient by passing your application API key into the constructor. Then call one of the Send methods.
32
+
There are 3 different types of exception data that you can use in the Send methods:
48
33
49
34
***Strings** provided by Unity for the error message and stack trace.
50
35
***Exception** .Net objects. Useful if you need to send handled exceptions in try/catch blocks.
51
36
***RaygunMessage** Allowing you to fully specify all the data fields that get sent to Raygun.io
52
37
38
+
If you already have a central place in your game for catching unhandled exceptions (to write the details to a log for example), then that will be a great place to send the exception information to Raygun.io.
39
+
If you aren't currently catching unhandled exceptions in your game, then a good way to do this is by listening to Application.RegisterLogCallback.
40
+
In the following example, Application.RegisterLogCallback has been set up in a MonoBehaviour that will be run during the initialization process of the game.
41
+
In the handler, you can check to see if the type of the log is an exception or error. Alternatively, you could send all types of log messages.
42
+
53
43
```
54
-
RaygunClient client = new RaygunClient("YOUR_APP_API_KEY");
if (type == LogType.Exception || type == LogType.Error)
54
+
{
55
+
RaygunClient client = new RaygunClient("YOUR_APP_API_KEY");
56
+
client.Send(message, stackTrace);
57
+
}
58
+
}
59
+
}
56
60
```
57
61
62
+
**WARNING** RegisterLogCallback can only have one handler at a time, so if you already are using RegisterLogCallback,
63
+
then you'll want to send the exception information to Raygun.io within your existing callback.
64
+
58
65
Options
59
66
====================
60
67
61
68
####Application version
62
69
63
70
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.
64
-
If you are using the Attach method, you can get the RaygunClient instance from the static RaygunClient.Current property.
65
71
66
72
####User
67
73
68
-
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.
74
+
To keep track of how many users are affected by each exception, you can set the User or UserInfo property of the RaygunClient instance. The user can be any id string of your choosing to identify each user.
69
75
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.
70
-
If you are using the Attach method, you can get the RaygunClient instance from the static RaygunClient.Current property.
76
+
The UserInfo property lets you provide additional user information such as their name.
71
77
72
78
####Tags and custom data
73
79
74
-
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.
80
+
The Send method overloads allow you to send an optional list of tags or/and a dictionary of object data. You can use these to provide whatever additional information you want to help you debug exceptions.
0 commit comments