本篇文章会给大家介绍下unet spwan动态生成物体的相关内容,不了解的可以看看。
在Unet 中 你如果你遇到类似 的问题
Failed to spawn server object, assetId=309e0b989f7cc354e8f1dfb977e657e2 netId=10
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
应该是没有 手动把要添加的物体 添加到 Registered Spawnable Prefabs中
unity 官方API 给出 自定义 生产的方法
The default behaviour of creating spawned objects from prefabs on the client can be customized by using spawn handler functions. This way you have full control of how you spawn the object as well as how you un-spawn it. You can register functions to spawn and un-spawn client objects with ClientScene.RegisterSpawnHandler. The server creates objects directly and then spawn them on the clients though this functionality. This function takes the asset ID of the object and two function delegates, one to handle creating objects on the client and one to handler destroying objects on the client. The asset ID can be a dy