unet网络自定义训练代码_【Unet】unet spwan动态生成物体

本文介绍在Unity Unet中如何解决动态生成物体的问题,特别是针对'Failed to spawn server object'错误。文章提供了自定义spawn handler的方法,通过`ClientScene.RegisterSpawnHandler`动态注册生成和销毁物体的函数,避免手动将物体添加到Registered Spawnable Prefabs。文中给出了详细的代码示例,展示如何在客户端和服务器端实现子弹的生成和销毁。
摘要由CSDN通过智能技术生成

本篇文章会给大家介绍下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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值