mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
24 lines
766 B
C#
24 lines
766 B
C#
using UnityEngine;
|
|
|
|
namespace Mirror
|
|
{
|
|
/// <summary>Start position for player spawning, automatically registers itself in the NetworkManager.</summary>
|
|
[DisallowMultipleComponent]
|
|
[AddComponentMenu("Network/NetworkStartPosition")]
|
|
[HelpURL("https://mirror-networking.gitbook.io/docs/components/network-start-position")]
|
|
public class NetworkStartPosition : MonoBehaviour
|
|
{
|
|
public void Start()
|
|
{
|
|
// Do this in Start, not Awake, so NetworkManager::ResetStatics
|
|
// doesn't wipe start positions out of the list.
|
|
NetworkManager.RegisterStartPosition(transform);
|
|
}
|
|
|
|
public void OnDestroy()
|
|
{
|
|
NetworkManager.UnRegisterStartPosition(transform);
|
|
}
|
|
}
|
|
}
|