我正在尝试建立一个函数来更新玩家的精灵/颜色,基于一个不是来自单一行为的类,但由于这个原因,我不能将它添加到光子视图中。
我的游戏有一个名为PlayerDataClass的类,它存储本地玩家的所有信息。我还没有将它设置为单行为类,因为我希望能够访问它而不将它附加到游戏对象上。然而,由于这一点,我无法通过光子视图访问它。
有办法这样做吗?还是有更好的选择?
我目前只是记录附加到ColorTheme的PlayerDataClass变量的名称,但是它只是记录本地客户端变量,而不是调用函数的客户机。
PlayerDataClass.cs
using System.Collections;
using
我在Unity2021.1.5f中使用PUN2连接一个多人游戏。这是在安卓,iOS和视窗的工作。
当我为WebGL构建并试图连接到服务器时,会出现下一个错误:
Connect() failed to create a IPhotonSocket instance for WebSocketSecure.SocketImplementationConfig:
{Udp=ExitGames.Client.Photon.SocketUdp, Tcp=ExitGames.Client.Photon.SocketTcp,
WebSocket=ExitGames.Client.Photon.Socke
我正在使用本教程开发一个简单的AR多人应用程序。
一个用户将一个简单的3D立方体放在房间的某个地方,然后他和其他加入游戏的玩家可以通过点击一个按钮来更改它的材料,这将执行一个简单的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeMaterial : MonoBehaviour {
public Material material_1;
public Material material_2;
public G
我有一个使用手电筒的多人游戏,如果我按下L,手电筒也会关闭另一个游戏,但是当batteryTimeLeft达到20时,它只会在本地游戏中闪烁。
如何将整个脚本与所有用户同步,以便闪烁也通过网络?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class LightManager : Photon.MonoBehaviour {
public GameObject flashlight;
public Light lightinflashlight;
嘿,伙计们,我对光子有一些问题。这是密码;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class FinishManager : MonoBehaviour
{
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag(
在光子中,第一个加入的人可以看到两个玩家,而第二个加入的人不能看到第一个。有人知道为什么吗?连接到服务器脚本
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;
public class Connecttoserver : MonoBehaviourPunCallbacks
{
private void Start()
{
PhotonNetwork.ConnectUsingSettings();
我有一个类,它的结构如下:
public class Game : MonoBehaviour
{
public string Name { get; set;}
public int NumberOfPlayers { get; set; }
public int CurrentPlayers { get; set; }
public Game(string name, int num)
{
Name = name;
NumberOfPlayers = num;
Curren