[英]unity c# prefab, scene and network
i have two scene at unity. 我有两个场景。
if i make room or i join the room, the game make player(prefab) at second scene. 如果我腾出空间或我加入房间,游戏将在第二个场景制造玩家(预制)。
at first scene, i make room for network game in unity . 在第一个场景,我为网络游戏腾出了空间。
after i execute .exe file in window. 在窗口中执行.exe文件后。 so i can watch game screen and room list.
这样我就可以观看游戏画面和房间列表。
but when i make room or join the room i don't watch player prefab. 但是当我腾出空间或加入房间时,我不会看播放器预制件。
i found reason. 我找到了原因。
player prefab is created outside canvas. 播放器预制件是在画布外部创建的。
if i drag the player in Canvas , i can see player on game view. 如果我在“画布”中拖动玩家,则可以在游戏视图中看到玩家。
i want to create prefab in the canvas. 我想在画布上创建预制件。
i used this methods. 我用这种方法。
thank you for reading this question 感谢您阅读此问题
You need additional script that make player a child of canvas. 您需要使播放器成为画布子代的其他脚本。
EDIT Something like that (applied to player prefab): 编辑这样的东西(应用于播放器预制):
public Canvas canvas;
void Start()
{
transform.parent = canvas.transform;
Destroy(this);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.