Skip to content

Commit c7562d5

Browse files
authored
Merge pull request #233 from andgeno/docs
Improved Docs
2 parents 3308778 + 08892f9 commit c7562d5

File tree

4 files changed

+46
-12
lines changed

4 files changed

+46
-12
lines changed

docs/_data/docs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@
3535
- custom-transports
3636
- network-profiler-window
3737
- custom-serialization
38-
- boxing-systems
38+
- boxing-systems
39+
40+
- title: Troubleshooting
41+
docs:
42+
- common-mistakes

docs/_docs/getting-started/connection-approval.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The ConnectionData will then be passed to the server and it will decide if the c
3636

3737

3838
### Timeout
39-
The MLAPI uses a callback system in order to allow for external validation. Forexample, you might have a steam authentication ticket sent as the ConnectionData (encrypted and authenticated by the MLAPI) that you want to validate against steams servers. This can take some time. If you don't call the callback method within the time specified in the ``ClientConnectionBufferTimeout`` configuration. The connection will be dropped. This time starts counting when the transport has told the MLAPI about the connection. This means that you cannot attack the MLAPI by never sending the buffer, it will still time you out.
39+
The MLAPI uses a callback system in order to allow for external validation. For example, you might have a steam authentication ticket sent as the ConnectionData (encrypted and authenticated by the MLAPI) that you want to validate against steams servers. This can take some time. If you don't call the callback method within the time specified in the ``ClientConnectionBufferTimeout`` configuration the connection will be dropped. This time starts counting when the transport has told the MLAPI about the connection. This means that you cannot attack the MLAPI by never sending the buffer, it will still time you out.
4040

4141

4242
### Security

docs/_docs/the-basics/messaging-system.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ void MyMethod(int myInt)
2323

2424
#### Convenience Example
2525
```csharp
26-
private void Update()
26+
private void OnGUI()
2727
{
28-
if (GUI.Button("SendRandomInt"))
28+
if (GUILayout.Button("SendRandomInt"))
2929
{
3030
if (IsServer)
3131
{
@@ -41,14 +41,14 @@ private void Update()
4141
[ServerRPC]
4242
private void MyServerRPC(int number)
4343
{
44-
Debug.Log("The number recieved was: " + number);
44+
Debug.Log("The number received was: " + number);
4545
Debug.Log("This method ran on the server upon the request of a client");
4646
}
4747

4848
[ClientRPC]
4949
private void MyClientRPC(int number)
5050
{
51-
Debug.Log("The number recieved was: " + number);
51+
Debug.Log("The number received was: " + number);
5252
Debug.Log("This method ran on the client upon the request of the server");
5353
}
5454
```
@@ -83,9 +83,9 @@ public float MyRpcWithReturnValue(float x, float y)
8383
To use the performance mode, the RPC method require the following signature ``void (ulong clientId, Stream readStream)`` and the sender is required to use the non generic Stream overload.
8484

8585
```csharp
86-
private void Update()
86+
private void OnGUI()
8787
{
88-
if (GUI.Button("SendRandomInt"))
88+
if (GUILayout.Button("SendRandomInt"))
8989
{
9090
if (IsServer)
9191
{
@@ -120,7 +120,7 @@ private void MyServerRPC(ulong clientId, Stream stream) //This signature is REQU
120120
using (PooledBitReader reader = PooledBitReader.Get(stream))
121121
{
122122
int number = reader.ReadInt32Packed();
123-
Debug.Log("The number recieved was: " + number);
123+
Debug.Log("The number received was: " + number);
124124
Debug.Log("This method ran on the server upon the request of a client");
125125
}
126126
}
@@ -131,7 +131,7 @@ private void MyClientRPC(ulong clientId, Stream stream) //This signature is REQU
131131
using (PooledBitReader reader = PooledBitReader.Get(stream))
132132
{
133133
int number = reader.ReadInt32Packed();
134-
Debug.Log("The number recieved was: " + number);
134+
Debug.Log("The number received was: " + number);
135135
Debug.Log("This method ran on the client upon the request of the server");
136136
}
137137
}
@@ -167,9 +167,9 @@ If you don't want to use the MLAPI's messaging. You don't have to. You can use a
167167

168168
#### Usage
169169
```csharp
170-
void Start()
170+
private void Start()
171171
{
172-
//Recieving
172+
//Receiving
173173
NetworkingManager.Singleton.OnIncommingCustomMessage += ((clientId, stream) =>
174174
{
175175
using (PooledBitReader reader = PooledBitReader.Get(stream))
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Common Mistakes
3+
permalink: /wiki/common-mistakes/
4+
---
5+
6+
This is a collection of common mistakes:
7+
8+
- [`NullReferenceException` when trying to start a server/host/client](#err-001)
9+
10+
---
11+
12+
### <a name="err-001"></a>`NullReferenceException` when trying to start a server/host/client
13+
14+
#### Problem
15+
When trying to start a server, host, or client by executing one of these lines of code
16+
17+
```csharp
18+
NetworkingManager.Singleton.StartServer()
19+
NetworkingManager.Singleton.StartHost()
20+
NetworkingManager.Singleton.StartClient()
21+
```
22+
23+
the following exception is thrown:
24+
25+
```csharp
26+
NullReferenceException: Object reference not set to an instance of an object
27+
```
28+
29+
#### Solution
30+
You most likely forgot to add the `NetworkingManager` component to a game object in your scene.

0 commit comments

Comments
 (0)