Skip to content

chore: phase-1 api documentation update #3158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ Visit the [Multiplayer Docs Site](https://docs-multiplayer.unity3d.com/) for pac

You can also jump right into our [Hello World](https://docs-multiplayer.unity3d.com/netcode/current/tutorials/helloworld) guide for a taste of how to use the framework for basic networked tasks.

### Netcode for GameObjects v2
The most recent version of Netcode for GameObjects (v2) includes several improvements along with the more recent [distributed authority network topology](https://docs-multiplayer.unity3d.com/netcode/current/terms-concepts/distributed-authority/) feature. You can find the source code for this on the [develop-2.0.0 branch](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/tree/develop-2.0.0).
- The develop-2.0.0 branch incudes additional examples:
- [Netcode for GameObjects Smooth Transform Space Transitions](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/tree/develop-2.0.0/Examples/CharacterControllerMovingBodies)
- This example has plenty of parenting examples, parenting under moving bodies, smooth transitioning between two parents, and a basic example of path defined motion.
- [Ping Tool](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/tree/develop-2.0.0/Examples/PingTool)
- This includes a custom Runtime Netwokr Stats Monitor that includes client to client message processing ping times.

### Community and Feedback

For general questions, networking advice or discussions about Netcode for GameObjects, please join our [Discord Community](https://discord.gg/FM8SE9E) or create a post in the [Unity Multiplayer Forum](https://forum.unity.com/forums/multiplayer.26/).

### Compatibility

Netcode for GameObjects targets the following Unity versions:
- Unity 2021.3(LTS), and 2022.3(LTS)
- Unity 2021.3(LTS), 2022.3(LTS), and Unity 6 (6000.0)

On the following runtime platforms:
- Windows, MacOS, and Linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,54 @@

namespace Unity.Netcode
{

/// <summary>
/// The connection event type set within <see cref="ConnectionEventData"/> to signify the type of connection event notification received.
/// </summary>
/// <remarks>
/// <see cref="ConnectionEventData"/> is returned as a parameter of the <see cref="NetworkManager.OnConnectionEvent"/> event notification.
/// <see cref="ClientConnected"/> and <see cref="ClientDisconnected"/> event types occur on the client-side of the newly connected client and on the server-side. <br />
/// <see cref="PeerConnected"/> and <see cref="PeerDisconnected"/> event types occur on connected clients to notify that a new client (peer) has joined/connected.
/// </remarks>
public enum ConnectionEvent
{
/// <summary>
/// This event is set on the client-side of the newly connected client and on the server-side.<br />
/// </summary>
/// <remarks>
/// On the newly connected client side, the <see cref="ConnectionEventData.ClientId"/> will be the <see cref="NetworkManager.LocalClientId"/>.<br />
/// On the server side, the <see cref="ConnectionEventData.ClientId"/> will be the ID of the client that just connected.
/// </remarks>
ClientConnected,
/// <summary>
/// This event is set on clients that are already connected to the session.
/// </summary>
/// <remarks>
/// The <see cref="ConnectionEventData.ClientId"/> will be the ID of the client that just connected.
/// </remarks>
PeerConnected,
/// <summary>
/// This event is set on the client-side of the client that disconnected client and on the server-side.
/// </summary>
/// <remarks>
/// On the disconnected client side, the <see cref="ConnectionEventData.ClientId"/> will be the <see cref="NetworkManager.LocalClientId"/>.<br />
/// On the server side, this will be the ID of the client that disconnected.
/// </remarks>
ClientDisconnected,
/// <summary>
/// This event is set on clients that are already connected to the session.
/// </summary>
/// <remarks>
/// The <see cref="ConnectionEventData.ClientId"/> will be the ID of the client that just disconnected.
/// </remarks>
PeerDisconnected
}

/// <summary>
/// Returned as a parameter of the <see cref="NetworkManager.OnConnectionEvent"/> event notification.
/// </summary>
/// <remarks>
/// See <see cref="ConnectionEvent"/> for more details on the types of connection events received.
/// </remarks>
public struct ConnectionEventData
{
public ConnectionEvent EventType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,28 @@ public enum SendTo
SpecifiedInParams
}

/// <summary>
/// This parameter configures a performance optimization. This optimization is not valid in all situations.<br />
/// Because BaseRpcTarget is a managed type, allocating a new one is expensive, as it puts pressure on the garbage collector.
/// </summary>
/// <remarks>
/// When using a <see cref="Temp"/> allocation type for the RPC target(s):<br />
/// You typically don't need to worry about persisting the <see cref="BaseRpcTarget"/> generated.
/// When using a <see cref="Persistent"/> allocation type for the RPC target(s): <br />
/// You will want to use <see cref="RpcTarget"/>, which returns <see cref="BaseRpcTarget"/>, during <see cref="NetworkBehaviour"/> initialization (i.e. <see cref="NetworkBehaviour.OnNetworkPostSpawn"/>) and it to a property.<br />
/// Then, When invoking the RPC, you would use your <see cref="BaseRpcTarget"/> which is a persisted allocation of a given set of client identifiers.
/// !! Important !!<br />
/// You will want to invoke <see cref="BaseRpcTarget.Dispose"/> of any persisted properties created via <see cref="RpcTarget"/> when despawning or destroying the associated <see cref="NetworkBehaviour"/> component's <see cref="NetworkObject"/>. Not doing so will result in small memory leaks.
/// </remarks>
public enum RpcTargetUse
{
/// <summary>
/// Creates a temporary <see cref="BaseRpcTarget"/> used for the frame an <see cref="RpcAttribute"/> decorated method is invoked.
/// </summary>
Temp,
/// <summary>
/// Creates a persisted <see cref="BaseRpcTarget"/> that does not change and will persist until <see cref="BaseRpcTarget.Dispose"/> is called.
/// </summary>
Persistent
}

Expand Down