- Home /
Question by
Icarus_10 · Jun 10, 2020 at 12:44 PM ·
networkingmultiplayer-networkingparent and child
How to parent object to player prefab in unity Unet networking
I am trying to make a customization system in unity multiplayer.
[Header("Body Parts")]
public GameObject Head;
void Start()
{
SetCustomsClient();
}
[Client]
void SetCustomsClient()
{
if (!isLocalPlayer)
{
return;
}
CmdOnSetCustoms();
}
public GameObject eye;
//Server Informed
[Command]
void CmdOnSetCustoms()
{
RpcSpawnCustoms();
}
//Spawns Eye
[ClientRpc]
void RpcSpawnCustoms()
{
GameObject _eyeInst = Instantiate(eye, transform.position, Quaternion.identity);
_eyeInst.transform.parent = Head.transform;
}
this is the script i used for a customization receiver script. It works fine without the
_eyeInst.transform.parent = Head.transform;
part. I just want to parent the eye to the player's head through the server on this client. Pls help.
Comment
Your answer
Follow this Question
Related Questions
UNet - Connecting and Testing a 'choose your character' scenario 0 Answers
Best way to choose Google Play Realtime Multiplayer Host? 0 Answers
Network command is running on client? 1 Answer
Photon Networking not synchronizing 0 Answers
RPC and Command Calls OR Network messages for syncing variables across Server and Client? 0 Answers