Here are some tips when you receive an error either in the Unity Editor or in Visual Studio or other code editor.
-
Copy the error message exactly. Often you can highlight the error text, then right click and copy the text to the clipboard
-
Generally the first step in troubleshooting is to use Google search. Our documentation and forums are indexed by Google. Here are a few tips:
- Remove the line number in the error text before doing a Search. Chances are that your line number in your own code is unique, so would not be expected to turn up in a Google search
- Precede the error text with the words "Unity error " followed by the exact error text, this will help to focus the search results.
- Often, the answer will be in the first few top results. Take a few minutes to review the top 3 links for example, and see if the links are relevant
- Don’t spend more than 10-15 minutes going down a Google search rabbit hole however.
- One technique to use in your troubleshooting is runtime debugging. There is more information here:
- If you are using online services like Advertising, Charles Proxy can be very helpful in diagnosing issues. There is more information here:
- If the error occurs on a device but not in the Editor, then the device logs are very helpful
- At this point if you continue to have issues, it’s best to post on the relevant Unity forum. In your forum post, post your error and mention what you’ve tried already, and perhaps share the Google search link(s) that you tried. This will help others to assist you better, knowing what you’ve already tried. Also provide sufficient steps so someone else can easily reproduce your issue in an empty project (ideally). Post your code, using Code Tags, and mention the Unity version that you are using.