I can't see other players
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
I can't see other players
KaasKnaller
2019-10-13 09:31:16
Hello, I've made a fps game so far, but I can't see other players. And i don't know what to do, because I'm a beginning Developer. So can someone help me out of this? Here is the connection part of my connectionmanager.
{
int state;
string playerName;
string roomName;
public GUISkin conGUI;
public AudioSource aSource;
public AudioClip clickSound;
public AudioClip backSound;
bool connecting;
private Dictionary cachedRoomList;
bool listRefreshed;
Vector2 scroll;
public int[] maxPlayers;
int players = 2;
public string[] gameMode;
int modeIndex;
public string[] mapList;
int mapIndex;
string prefix = "GunSquad";
public string currentVersion = "1.0";
public bool showConnectionStatus;
[Header("Customization")]
public GameObject dummy;
public Renderer eyeRenderer;
static int eyeIndex = 0;
public Renderer bodyRenderer;
static int bodyIndex = 1;
public static string[] colorList = new string[]{"Black", "White", "Red", "Green", "Blue"};
public static Color[] colors = new Color[]{new Color(0.09f,0.09f,0.09f,1), new Color(1,1,1,1), new Color(1,0.14f,0.14f,1), new Color(0,1,0,1), new Color(0,0.67f,1,1)};
static int selectedRegion = 1;
public enum Regions {EU = 1, US = 2, RU = 3, BR = 4}
public Regions defaultRegion = Regions.EU;
void Awake()
{
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
Application.targetFrameRate = -1;
selectedRegion = (int)defaultRegion;
}
void Start()
{
PhotonNetwork.IsMessageQueueRunning = true;
PhotonNetwork.SendRate = 20;
PhotonNetwork.SerializationRate = 10;
PhotonNetwork.AutomaticallySyncScene = true;
cachedRoomList = new Dictionary();
roomName = "GunSquad (" + Random.Range(10, 999) + ")";
if(PhotonNetwork.LocalPlayer.NickName == "")
{
playerName = "Guest (" + Random.Range(10, 999) + ")";
SavePlayerProps();
}
else
{
playerName = PhotonNetwork.LocalPlayer.NickName;
state = 1;
}
PhotonNetwork.GameVersion = prefix + currentVersion;
PhotonNetwork.ConnectUsingSettings();
ConnectToRegion();
}
void ConnectToRegion()
{
if(PhotonNetwork.IsConnected) PhotonNetwork.Disconnect();
if(selectedRegion == 2){
PhotonNetwork.ConnectToRegion("us");
}else if(selectedRegion == 3){
PhotonNetwork.ConnectToRegion("ru");
}else if(selectedRegion == 4){
PhotonNetwork.ConnectToRegion("sa");
}else{
PhotonNetwork.ConnectToRegion("eu");
}
}
Comments
KaasKnaller
2019-10-13 10:08:31
But I can see the bullet holes, so there is something wrong.
Can i see how you are connecting to the game world where the players operate?
KaasKnaller
2019-10-13 13:48:32
Do you have discord?
Then can i send a video.
Preferably screenshots here would help so that other users with similar issues can learn from it.
Hi @KaasKnaller,
Thank you for choosing Photon!
How do you instantiate player objects?
Do you use PhotonNetwork.Instantiate or something else?
Also maybe there is an issue with matchmaking; check out our "Matchmaking Checklist".
KaasKnaller
2019-10-14 16:00:25
@JohnTube I've fixed this error. I can see the player now. But there some other bug: Assertion failed on expression: '(!CompareApproximately(aScalar, 0.0F)' Here is a screen shot of the code: https://gyazo.com/479016af67f0f02a00201966e22f6407 I hope you can help me with this.
Hi @KaasKnaller,
Could you share the full stack trace of the exception?
Also, what PUN version are you using?
KaasKnaller
2019-10-14 17:42:40
Hey @JohnTube I'm using PUN2, and here is the full stack trace:
Assertion failed on expression: '!CompareApproximately(aScalar, 0.0F)'
0x0000000141414DC8 (Unity) StackWalker::GetCurrentCallstack
0x000000014141B276 (Unity) StackWalker::ShowCallstack
0x00000001412FEA6B (Unity) GetStacktrace
0x000000014014303E (Unity) DebugStringToFile
0x000000014019DC6C (Unity) operator/
0x00000001408C3F8E (Unity) Lerp
0x00000001417DABDA (Unity) Quaternion_CUSTOM_Lerp_Injected
0x000000001C69A818 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Quaternion:Lerp_Injected (UnityEngine.Quaternion&,UnityEngine.Quaternion&,single,UnityEngine.Quaternion&)
0x000000001C69A67B (Mono JIT Code) UnityEngine.Quaternion:Lerp (UnityEngine.Quaternion,UnityEngine.Quaternion,single)
0x000000001C6997DB (Mono JIT Code) [PlayerNetworkInstance.cs:43] UnrealFPS.Network.PlayerNetworkInstance:Update ()
0x000000001CB355B8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFE9F5BBE7B (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
0x00007FFE9F541E32 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
0x00007FFE9F54AE3F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
0x0000000140C0069A (Unity) scripting_method_invoke
0x0000000140BF09EA (Unity) ScriptingInvocation::Invoke
0x0000000140BB95D7 (Unity) MonoBehaviour::CallMethodIfAvailable
0x0000000140BB9CF1 (Unity) MonoBehaviour::CallUpdateMethod
0x00000001406EBF2C (Unity) BaseBehaviourManager::CommonUpdate
0x00000001406F2616 (Unity) BehaviourManager::Update
0x000000014095C703 (Unity) InitPlayerLoopCallbacks'::
2'::UpdateScriptRunBehaviourUpdateRegistrator::Forward
0x000000014095B357 (Unity) ExecutePlayerLoop
0x000000014095B423 (Unity) ExecutePlayerLoop
0x000000014095E6E1 (Unity) PlayerLoop
0x000000014133D25F (Unity) PlayerLoopController::UpdateScene
0x000000014133B810 (Unity) Application::TickTimer
0x0000000141497C4B (Unity) MainMessageLoop
0x00000001414998E6 (Unity) WinMain
0x00000001424846FA (Unity) __scrt_common_main_seh
0x00007FFF04347974 (KERNEL32) BaseThreadInitThunk
0x00007FFF06ACA271 (ntdll) RtlUserThreadStart
KaasKnaller
2019-10-19 11:26:52
@JohnTube ?
Hi @KaasKnaller,
Sorry for the delay.
It looks like this is not a PUN issue.
The issue seems to happen in line 43 of the file "PlayerNetworkInstance.cs".
The error is related to Quaternion lerp inside the Update
method of the class UnrealFPS.Network.PlayerNetworkInstance
.
It could be a Unity issue or a missing script reference.
You could search "Assertion failed on expression: '!CompareApproximately(aScalar, 0.0F)'" on Google.