Skip to content

Commit 7dc16c0

Browse files
authored
docs: Update common-mistakes.md (#333)
Add [`NullReferenceException` when trying to send an RPC to the server]
1 parent e489606 commit 7dc16c0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/_docs/troubleshooting/common-mistakes.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ permalink: /wiki/common-mistakes/
66
This is a collection of common mistakes:
77

88
- [`NullReferenceException` when trying to start a server/host/client](#err-001)
9+
- [`NullReferenceException` when trying to send an RPC to the server](#err-002)
910

1011
---
1112

@@ -28,3 +29,19 @@ NullReferenceException: Object reference not set to an instance of an object
2829

2930
#### Solution
3031
You most likely forgot to add the `NetworkingManager` component to a game object in your scene.
32+
33+
---
34+
35+
### <a name="err-002"></a>`NullReferenceException` when trying to send an RPC to the server
36+
37+
#### Problem
38+
When the client tries to run `InvokeServerRpc`, the following exception is thrown:
39+
40+
```csharp
41+
NullReferenceException: Object reference not set to an instance of an object
42+
```
43+
44+
#### Solution
45+
You most likely forgot to `Spawn()` your object.
46+
47+
Run `Spawn()` on your `NetworkedObject` component as the server to fix this issue.

0 commit comments

Comments
 (0)