• Home
  • Tutorials
  • API Documentation
  • Asset Store
Show / Hide Table of Contents
  • SuperNet.Netcode.Compress
    • CompressorDeflate
    • CompressorLZF
    • ICompressor
  • SuperNet.Netcode.Crypto
    • CryptoAES
    • CryptoECDH
    • CryptoRandom
    • CryptoRSA
    • Curve25519
    • ICryptoAuthenticator
    • ICryptoEncryptor
    • ICryptoExchanger
    • ICryptoRandom
  • SuperNet.Netcode.Transport
    • ConnectionRequest
    • DisconnectReason
    • Host
    • HostConfig
    • HostEvents
    • HostStatistics
    • HostTimespan
    • HostTimestamp
    • IHostListener
    • IMessage
    • IMessageListener
    • IPeerListener
    • MessageEvents
    • MessageReceived
    • MessageSent
    • Peer
    • PeerConfig
    • PeerEvents
    • PeerStatistics
  • SuperNet.Netcode.Util
    • Allocator
    • ArrayPool<T>
    • CRC32
    • IPComparer
    • IPResolver
    • IWritable
    • ObjectPool<T>
    • Reader
    • Serializer
    • Writer
  • SuperNet.Unity.Components
    • INetworkAuthoritative
    • INetworkRegisterable
    • INetworkRollbackable
    • NetworkAnimation
    • NetworkAnimator
    • NetworkAuthority
    • NetworkPrefab
    • NetworkRegistrar
    • NetworkSpawner
    • NetworkSyncModeMethod
    • NetworkSyncModeVector2
    • NetworkSyncModeVector3
    • NetworkTransform
  • SuperNet.Unity.Core
    • NetworkComponent
    • NetworkHost
    • NetworkIdentity
    • NetworkIdentityExtensions
    • NetworkManager
  • SuperNet.Unity.Editor
    • NetworkAuthorityEditor
    • NetworkHostEditor
    • NetworkHostEditor.BandwithUnit
    • NetworkIdentityDrawer
    • NetworkManagerEditor
    • NetworkPrefabEditor
    • NetworkSpawnerEditor

Class NetworkSpawner

Manages spawnable network prefabs.

Inheritance
System.Object
NetworkComponent
NetworkSpawner
Implements
INetworkAuthoritative
Inherited Members
NetworkComponent.NetworkID
NetworkComponent.IsRegisteredOnNetwork
NetworkComponent.OnDestroy()
NetworkComponent.ResetNetworkID()
NetworkComponent.GetNetworkPeers()
NetworkComponent.Run(Action)
NetworkComponent.Run(Action, Single)
NetworkComponent.RunAsync(Action)
NetworkComponent.SendNetworkMessage(IMessage)
NetworkComponent.SendNetworkMessage(IMessage, Predicate<Peer>)
NetworkComponent.SendNetworkMessage(IMessage, IEnumerable<Peer>)
NetworkComponent.SendNetworkMessage(IMessage, Peer[])
NetworkComponent.OnNetworkUnregister()
NetworkComponent.OnNetworkRegister(NetworkComponent)
NetworkComponent.OnNetworkUnregister(NetworkComponent)
Namespace: SuperNet.Unity.Components
Assembly: cs.temp.dll.dll
Syntax
public sealed class NetworkSpawner : NetworkComponent, INetworkAuthoritative

Fields

Locked

True if only authority can spawn. Set to false to let anybody spawn.

Declaration
public bool Locked
Field Value
Type Description
System.Boolean

Parent

The parent transform to spawn under.

Declaration
public Transform Parent
Field Value
Type Description
Transform

Prefab

The prefab to clone when spawning.

Declaration
public NetworkPrefab Prefab
Field Value
Type Description
NetworkPrefab

SyncChannel

Network channel to use.

Declaration
public byte SyncChannel
Field Value
Type Description
System.Byte

Properties

IsAuthority

True if we can spawn and despawn.

Declaration
public bool IsAuthority { get; }
Property Value
Type Description
System.Boolean

Methods

Despawn(NetworkPrefab, Boolean)

Despawn an instantiated instance and optionally destroy it.

Declaration
public bool Despawn(NetworkPrefab instance, bool destroy = true)
Parameters
Type Name Description
NetworkPrefab instance

Instance to despawn.

System.Boolean destroy

True to also destroy the instance.

Returns
Type Description
System.Boolean

True if despawned, false if not.

DespawnAll(Boolean)

Despawn all instantiated instances and optionally destroy them.

Declaration
public void DespawnAll(bool destroy = true)
Parameters
Type Name Description
System.Boolean destroy

True to also destroy the instances.

GetSpawnedPrefabs()

Get all spawned instances as a list.

Declaration
public IReadOnlyList<NetworkPrefab> GetSpawnedPrefabs()
Returns
Type Description
System.Collections.Generic.IReadOnlyList<NetworkPrefab>

All spawned instances.

OnNetworkConnect(Peer)

Declaration
public override void OnNetworkConnect(Peer peer)
Parameters
Type Name Description
Peer peer
Overrides
NetworkComponent.OnNetworkConnect(Peer)

OnNetworkDisconnect(Peer)

Declaration
public override void OnNetworkDisconnect(Peer peer)
Parameters
Type Name Description
Peer peer
Overrides
NetworkComponent.OnNetworkDisconnect(Peer)

OnNetworkMessage(Peer, Reader, MessageReceived)

Declaration
public override void OnNetworkMessage(Peer peer, Reader reader, MessageReceived info)
Parameters
Type Name Description
Peer peer
Reader reader
MessageReceived info
Overrides
NetworkComponent.OnNetworkMessage(Peer, Reader, MessageReceived)

OnNetworkRegister()

Declaration
public override void OnNetworkRegister()
Overrides
NetworkComponent.OnNetworkRegister()

OnNetworkResend(Peer, Peer, Reader, MessageReceived)

Declaration
public override bool OnNetworkResend(Peer origin, Peer peer, Reader reader, MessageReceived info)
Parameters
Type Name Description
Peer origin
Peer peer
Reader reader
MessageReceived info
Returns
Type Description
System.Boolean
Overrides
NetworkComponent.OnNetworkResend(Peer, Peer, Reader, MessageReceived)

SetAuthority(Boolean)

Update authority on this component.

Declaration
public void SetAuthority(bool authority)
Parameters
Type Name Description
System.Boolean authority

Authority to set.

Spawn(NetworkPrefab)

Spawn an already instantiated prefab.

Declaration
public void Spawn(NetworkPrefab instance)
Parameters
Type Name Description
NetworkPrefab instance

Instantiated prefab.

Spawn(Boolean)

Spawn a network instance and notify the network.

Declaration
public NetworkPrefab Spawn(bool relativeToSpawner = true)
Parameters
Type Name Description
System.Boolean relativeToSpawner

True to position the new object relative to the spawner.

Returns
Type Description
NetworkPrefab

The instantiated clone.

Spawn(Vector3, Quaternion, Boolean)

Spawn a network instance and notify the network.

Declaration
public NetworkPrefab Spawn(Vector3 position, Quaternion rotation, bool relativeToParent = false)
Parameters
Type Name Description
Vector3 position

Position for the new object.

Quaternion rotation

Orientation of the new object.

System.Boolean relativeToParent

True to position the new object relative to spawn parent.

Returns
Type Description
NetworkPrefab

The instantiated clone.

Start()

Declaration
protected override void Start()
Overrides
NetworkComponent.Start()

Explicit Interface Implementations

INetworkAuthoritative.OnNetworkAuthorityUpdate(Boolean, HostTimestamp)

Declaration
void INetworkAuthoritative.OnNetworkAuthorityUpdate(bool authority, HostTimestamp timestamp)
Parameters
Type Name Description
System.Boolean authority
HostTimestamp timestamp

Implements

INetworkAuthoritative
Back to top Generated by DocFX