WIP for Opsive Character Controller networked using the Unity Netcode for GameObjects.
Basic networked menu for testing, with some basic customization using unity GUIStyle.
Unity sytle networking menu gui, help with testing Server/Client connection setup.
Setting up the player UCC prefab, use the tool menu to open up the dialog box, drag the Player prefab into the input field and than hit the Update Character button.The Player prefab will now have all the networking scripts added and ready for networking, the Player prefab should look like the screen-shot below.
Setting up the Character Ai UCC prefab, use the tool menu to open up the dialog box, drag the Character Ai prefab into the input field and than hit the Update Character button.The Character Ai prefab will now have all the networking scripts added and ready for networking, the Character Ai prefab should look like the screen-shot below.
All prefabs assigned to he UCC Object Pool will automatically be pooled with the Networked Object Pool, when using the interface for spawning the prefabs over the network.
Provides built-in support for Object Pooling, allows to override the default Netcode destroy and spawn handlers, for storing destroyed network objects in a pool for reuse.
m_SpawnObject = ObjectPool.Instantiate (m_CloneObject, Vector3.zero, Quaternion.identity);
NetworkedObjectPool.NetworkSpawn (m_CloneObject, m_SpawnObject, true);
Pickup items must be added to the networked pool and spawned in at runtime, pickup items cannot be in the OPSIVE Object Pool, otherwise they will all spawn into the game world.
[SerializeField] private GameObject m_SwordPickup;
private void Spawn () {
var go = ObjectPool.Instantiate (m_SwordPickup, Vector3.zero, Quaternion.identity);
NetworkedObjectPool.NetworkSpawn (m_SwordPickup, go, true);
}
The Pickup Item prefab will now have all the networking scripts added and ready for networking, the Pickup Item prefab should look like the screen-shot below.
Spawning prefabs into the game world must be in the network prefab list, this will insure that server will spawn automatically across networked clients.