因为用不来屏幕索引什么的,需求的玩家视野也不多,就避开了这个坑。用摄像头跟踪玩家,使用(isLocalPlayer)调整客户端的摄像头的active。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class setCamera : NetworkBehaviour {
public GameObject Maincamera;
public GameObject Camera1;
void Start(){
Maincamera = GameObject.Find ("MainCamera");//我的两个camera都设在scene里面,脚本跟在一个玩家角色上。
Camera1 = GameObject.Find ("Camera");
if (isLocalPlayer) {
Maincamera.SetActive(false);
} else {
Camera1.SetActive (false);
}
}
}