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()
{
}
}
我會嘗試.. –
我剛剛嘗試了上面的代碼,我禁用了控制輸入的腳本以及播放器上的其他腳本。結果是他們是獨立的,但其中只有一個可以移動。 –