Important: UNet is a deprecated solution, and a new Multiplayer and Networking Solution (Netcode for GameObjects) is under development. For more information and next steps see the information on the Unity Netcode for GameObjects website. |
Network Transform Visualizer 是一个实用程序组件,用于可视化使用 Network Transform 组件的游戏对象的插值。要使用此组件,请将其添加到已具有 Network Transform 组件的游戏对象,并在 Inspector 中分配一个预制件。该预制件可以是所选的任何项,它将用作游戏对象的传入变换数据的直观表示。
GameObjects with local authority (such as the local player) aren’t interpolated, and therefore won’t show a visualizer GameObject. The visualizer will only show other Networked GameObjects controlled by other computers on the network (such as other players).
Inspector 窗口中的 Network Transform Visualizer 组件
属性 | 功能 |
---|---|
Visualizer Prefab | 定义用于可视化网络变换目标位置的预制件。 |
正在运行游戏时,预制件被实例化为“可视化工具”游戏对象。当 Network Transform 游戏对象移动时,可视化工具游戏对象会显示在 Network Transform 的目标位置。
可以选择任何所需的可视化工具预制件。下面的示例中使用了半透明的洋红色立方体。
该组件在移动时通常看起来比 Network Transform 游戏对象略微靠前,但流畅度更低。这是因为该组件显示的是直接来自网络的原始位置数据,而不是使用插值来平滑地到达每个新的目标位置。
具有 Network Transform Visualizer 组件的游戏对象必须还必须具有 Network Identity 组件。在某个游戏对象上创建 Network Transform Visualizer 组件时,Unity 还将在该游戏对象上创建 Network Transform 组件和 Network Identity 组件(如果还没有这些组件)。
注意:确保选择用作可视化游戏对象的预制件没有附加碰撞体,或任何其他可能影响游戏运行的组件!
NetworkTransformVisualizer
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.