Troubleshooting Unity SDK
Handling errors with exceptions
The PubNub Unity SDK normally returns error objects through callbacks during operation failures. While this approach is suitable for production environments, it can limit debugging capabilities during development.
Enabling exceptions provides more comprehensive stack traces and integrates with Unity's debugging tools, allowing errors to be caught at their source.
Enable exceptions
The callback can throw exceptions instead of errors. To enable exceptions:
-
In the Unity Editor, go to
File
->Build Settings
->Player Settings
->Other Settings
->Configuration
>Scripting define symbols
. Do this for each of the platforms you want to enable exceptions. -
After you type
ENABLE_PUBNUB_EXCEPTIONS
, remember to press Return with the focus in the text box, or Unity Editor will not save your setting.