Attached is an example of networked object pool for UNet. It uses custom spawn handler functions and has object pools on the host and clients.
Instances of the specified "Prefab" object are created at initialization time, and then used when spawn messages are recieved, so there is no run-time object allocation and destruction.
View attachment 162909
The pooled object are controlled by the server. Example usage in a player script:
Networked object pool example for UNet HLAPI
Instances of the specified "Prefab" object are created at initialization time, and then used when spawn messages are recieved, so there is no run-time object allocation and destruction.
View attachment 162909
The pooled object are controlled by the server. Example usage in a player script:
Code (CSharp):
- using UnityEngine;
- using...