0
私はマルチプレイヤードッジボールゲームを作っています。ホストとクライアントを起動するたびに、プレイヤーの1人だけが移動できます。 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()
{
}
}
私はそれを試してみるでしょう。 –
私は上記のコードを試しました、私は入力を制御するスクリプトとプレーヤー上の他のスクリプトを無効にしました。その結果、彼らは独立していますが、そのうちの1人だけが動くことができます。 –