我正在开发2D游戏,使用光子后我的画布消失了。当我的播放器死亡并且图像继续移动时,才会显示“画布”。如何使我的画布始终显示在屏幕上(画布具有高分和高分,游戏结束,重新启动按钮)。是否应该更改脚本中的某些内容?还是检查员?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PhotonManager : MonoBehaviour
{
[SerializeField] private GameObject player;
[SerializeField] private GameObject lobbyCamera;
// Use this for initialization
void Start()
{
PhotonNetwork.ConnectUsingSettings("1.0");
}
void OnJoinedLobby()
{
PhotonNetwork.JoinOrCreateRoom("Room", new RoomOptions() { MaxPlayers = 2 }, TypedLobby.Default);
}
void OnJoinedRoom()
{
PhotonNetwork.Instantiate("Player", player.transform.position, Quaternion.identity, 0);
lobbyCamera.SetActive(false);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PhotonNetworking : MonoBehaviour
{
[SerializeField] private GameObject playerCamera;
[SerializeField] private MonoBehaviour[] scriptsToIgnore;
private PhotonView photonView;
// Use this for initialization
void Start()
{
photonView = GetComponent<PhotonView>();
Initialize();
}
void Initialize()
{
if (photonView.isMine)
{
}
else
{
playerCamera.SetActive(false);
foreach (MonoBehaviour item in scriptsToIgnore)
{
item.enabled = false;
}
}
}
}