PUN demo not working...

atriumgames

New member
I was trying to integrate this into my game, when I discovered on a build that it wasnt working so I created a blank 3D Project (mine is URP) to test the way the asset was originally built.

I am running Unity 2019.4.1 (LTS). I imported and installed the following in this order.


- UCC
- Pun2
- PUN Multiplayer Addon

and then following the instrustions, I opened the demo scene baked lights and saved it. Upon running the menu screen and connecting to the server I get the following errors....



Error: NullReferenceException: Object reference not set to an instance of an object Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Demo.PunDemoManager.OnPlayerEnteredRoom (Photon.Realtime.Player player, UnityEngine.GameObject character) (at Assets/Opsive/UltimateCharacterController/Add-Ons/Multiplayer/PhotonPUN/Demo/Scripts/PunDemoManager.cs:41) Opsive.Shared.Events.InvokableAction`2[T1,T2].Invoke (T1 arg1, T2 arg2) (at <fa7bae0bde914e57874fdb6999909243>:0) Opsive.Shared.Events.EventHandler.ExecuteEvent[T1,T2] (System.String eventName, T1 arg1, T2 arg2) (at <fa7bae0bde914e57874fdb6999909243>:0) Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Game.SpawnManagerBase.SpawnPlayer (Photon.Realtime.Player newPlayer) (at Assets/Opsive/UltimateCharacterController/Add-Ons/Multiplayer/PhotonPUN/Scripts/Game/SpawnManagerBase.cs:170) Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Game.SpawnManagerBase.Start () (at Assets/Opsive/UltimateCharacterController/Add-Ons/Multiplayer/PhotonPUN/Scripts/Game/SpawnManagerBase.cs:93) Opsive.UltimateCharacterController.Game.KinematicObjectManager:FixedUpdate() (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:844)


Error: There is no look source attached to the character. Ensure the character has a look source attached. For player characters the look source is the Camera Controller, and AI agents use the Local Look Source. UnityEngine.Debug:LogError(Object) Opsive.UltimateCharacterController.FirstPersonController.Character.MovementTypes.Combat:GetDeltaYawRotation(Single, Single, Single, Single) (at Assets/Opsive/UltimateCharacterController/Scripts/FirstPersonController/Character/MovementTypes/Combat.cs:32) Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:GetDeltaYawRotation() (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:196) Opsive.UltimateCharacterController.Game.KinematicCharacter:Move(Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:224)



I know pun works fine because if I use their demo I can get the lil unity guy to appear in the same room with a build and multiple instances of the game running.



[7:18 AM]
so its something with the Opsive version



The error seems centered around this section of the code so trying to debug why it claims there isnt an object assigned. the other error about the look source is likely due to the first, since it errors it cannot continue properly on that one is my guess.



[7:53 AM]
/// <summary> /// A player has entered the room. Initialize the Demo manager to the local player. /// </summary> /// <param name="player">The Photon Player that entered the room.</param> /// <param name="character">The character that the player controls.</param> private void OnPlayerEnteredRoom(Player player, GameObject character) { if (player.IsLocal) { #if FIRST_PERSON_CONTROLLER && THIRD_PERSON_CONTROLLER m_DefaultFirstPersonStart = PlayerPrefs.GetInt("START_PERSPECTIVE", m_DefaultFirstPersonStart ? 1 : 0) == 1; #endif InitializeCharacter(character, true, false); } }



[7:53 AM]
specifically its the if(player.IsLocal) section that is listed in the log, as thats line 41



[7:54 AM]
Assets/Opsive/UltimateCharacterController/Add-Ons/Multiplayer/PhotonPUN/Demo/Scripts/PunDemoManager.cs:41
 

atriumgames

New member
Its worth noting that the second error regarding the no look source goes away if I check the box in the initial menu screen, but the first error is still present. However despite checking the box the player is still in 3rd person view when loading the demopun level.
 

atriumgames

New member
Just tried making my own character, and menu and demo scene from scratch and doesnt work there either. Still cannot see other players
 

Justin

Administrator
Staff member
PUN version 2.19 changed the ownership and after talking to the PUN developers this was a bug on their side of things. They are submitting a new version which fixes this, but in the meantime I released version 1.1.4 of the PUN add-on which works around this issue.
 
Top