0
我正在制作一个多人躲避球游戏,每次我启动一个主机和一个客户端时,只有一个玩家可以移动。 if(!localplayer)不做任何事情
我希望玩家能够独立移动。这里是我的(更新)代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class Script4Network : NetworkBehaviour
{
// Use this for initialization
void Start() {
if (!isLocalPlayer)
{
gameObject.GetComponent<FirstPersonController>().enabled = false;
gameObject.GetComponent<throwing>().enabled = false;
gameObject.GetComponent<HeadBob>().enabled = false;
// gameObject.GetComponent<Camera>().enabled = false;
}
}
void Update()
{
}
}
我会尝试.. –
我刚刚尝试了上面的代码,我禁用了控制输入的脚本以及播放器上的其他脚本。结果是他们是独立的,但其中只有一个可以移动。 –