简体   繁体   中英

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. 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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM