PUN suddenly demanding I attach a "look source" out of nowhere.

StripeStooge

New member
"Error: There is no look source attached to the character. Ensure the character has a look source attached (such as a camera)."

I've been getting this error repeatedly, and I can't seem to find a fix for it. My multiplayer integration was going swimmingly, despite a few hitches, and then it completely came tumbling down with a sudden influx of ghost Null reference exceptions and, well, look source demands. I had to scrap the previous version, and essentially re-follow the steps I had previously to put together another multiplayer system, and that took care of the null reference exceptions. My previous version is unusable despite being previously quite solid, and I still can't decipher where all the null reference exceptions it's throwing a fit about are at.

As of right now, I'm mostly concerned with solving this look source problem, so I don't have to scrap everything and start yet again.
 

StripeStooge

New member
I should note that this is mainly a problem because any time another player joins my room, their camera is staring off into space, it seems like the character isn't even instantiated, and I get that error. First player in the room can do as they please, but everyone after them cannot join successfully beyond establishing a connection and being within the same server.
 

Justin

Administrator
Staff member
Does the demo scene work correctly? On The NetworkCharacterLocomotionHandler do you have AttachCamera enabled? When the game starts this will automatically attach the camera for local players. Beyond that what is the full stack trace of the first error?
 

StripeStooge

New member
Does the demo scene work correctly? On The NetworkCharacterLocomotionHandler do you have AttachCamera enabled? When the game starts this will automatically attach the camera for local players. Beyond that what is the full stack trace of the first error?

The demo scene still works fine. I've reimported all assets on my project just to be safe, and am still encountering the look source error.

AttachCamera is enabled on the NetworkCharacterLocomotionHandler.

Excuse me if this isn't what you meant by the full stack, I'm not completely used to terminology, but here you go.

"
Error: There is no look source attached to the character. Ensure the character has a look source attached (such as a camera).

UnityEngine.Debug:LogError(Object)

Opsive.UltimateCharacterController.ThirdPersonController.Character.MovementTypes.Combat:GetDeltaYawRotation(Single, Single, Single, Single) (at Assets/Opsive/UltimateCharacterController/Scripts/ThirdPersonController/Character/MovementTypes/Combat.cs:32)

Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:GetDeltaYawRotation() (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:196)

Opsive.UltimateCharacterController.Game.KinematicCharacter:FixedMove(Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:200)

Opsive.UltimateCharacterController.Game.KinematicObjectManager:FixedUpdate() (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:751)
"

I've checked these locations and nothing appears to be off, but I may just be a tad blind. I was up for around 24 hours that morning before throwing in the towel.
 

Justin

Administrator
Staff member
Is that the very first error? I would have expected something before that. Also, is this warning showing up for local players or remote players?

On the NetworkCharacterLocomotionHandler does it successfully assign the camera? This is done within the Start method.
 

devomage

Member
I get a similar error when moving from my match scene to a lobby scene. 2 errors each time. No networking installed.
 

StripeStooge

New member
Is that the very first error? I would have expected something before that. Also, is this warning showing up for local players or remote players?

On the NetworkCharacterLocomotionHandler does it successfully assign the camera? This is done within the Start method.

Well, that's the first thing that shows up labeled as an actual error on the local player console (Assuming local player is the room host/first player in room, and remotes are the ones who join in after).

Again, Remote players don't appear to have a character instantiated when they join, their camera stares off into nothingness (might still be on the menu scene, partially?), all the UI values are maxed (99 grenades, etc.), and they basically can't do anything. I haven't investigated into the remote errors too much, because I'm figuring that if the local player is encountering issues, then fixing its issues may help the remote player's issues.

Here's what the remote players see on their console:
Capture.PNG



And here's the Player.log file.

Code:
Mono path[0] = 'C:/Users/Timothy/Desktop/Unity Projects/Build/Cross-Horde Crisis Builds/V0.004 Debugging/CHC_PoC_Data/Managed'
Mono config path = 'C:/Users/Timothy/Desktop/Unity Projects/Build/Cross-Horde Crisis Builds/V0.004 Debugging/MonoBleedingEdge/etc'
PlayerConnection initialized from C:/Users/Timothy/Desktop/Unity Projects/Build/Cross-Horde Crisis Builds/V0.004 Debugging/CHC_PoC_Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55239
Multi-casting "[IP] 192.168.0.173 [Port] 55239 [Flags] 19 [Guid] 2139022819 [EditorId] 18069740 [Version] 1048832 [Id] WindowsPlayer(Timothy-PC) [Debug] 1 [PackageName] WindowsPlayer [ProjectName] CHC_PoC" to [225.0.0.222:54997]...
Waiting for connection from host on [0.0.0.0:55239]...
Remaining time:8s
Remaining time:7s
Remaining time:6s
Remaining time:5s
Remaining time:4s
Remaining time:3s
Remaining time:2s
Remaining time:1s
Remaining time:0s
Timed out. Continuing without host connection.
Started listening to [0.0.0.0:55239]
Starting managed debugger on port 56819
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=0.0.0.0:56819
PlayerConnection already initialized - listening to [0.0.0.0:55239]
Initialize engine version: 2019.3.2f1 (c46a3a38511e)
[Subsystems] Discovering subsystems at path C:/Users/Timothy/Desktop/Unity Projects/Build/Cross-Horde Crisis Builds/V0.004 Debugging/CHC_PoC_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1
Direct3D:
    Version:  Direct3D 11.0 [level 11.1]
    Renderer: NVIDIA GeForce GTX 1070 (ID=0x1b81)
    Vendor:   
    VRAM:     8088 MB
    Driver:   26.21.14.3200
Begin MonoManager ReloadAssembly
- Completed reload, in  0.530 seconds
D3D11 device created for Microsoft Media Foundation video decoding.
<RI> Initializing input.

<RI> Input initialized.

<RI> Initialized touch support.

UnloadTime: 6.572200 ms
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 12.260500 ms
NullReferenceException: Object reference not set to an instance of an object
  at Opsive.UltimateCharacterController.Items.Item.Awake () [0x0001e] in C:\Users\Timothy\Desktop\Unity Projects\Git Stuffs\CHC_PoC\Assets\Opsive\UltimateCharacterController\Scripts\Items\Item.cs:193
 
(Filename: C:/Users/Timothy/Desktop/Unity Projects/Git Stuffs/CHC_PoC/Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs Line: 193)

NullReferenceException: Object reference not set to an instance of an object
  at Opsive.UltimateCharacterController.Items.ItemPerspectiveProperties.Awake () [0x00059] in C:\Users\Timothy\Desktop\Unity Projects\Git Stuffs\CHC_PoC\Assets\Opsive\UltimateCharacterController\Scripts\Items\ItemPerspectiveProperties.cs:47
  at Opsive.UltimateCharacterController.ThirdPersonController.Items.ThirdPersonMeleeWeaponProperties.Awake () [0x00001] in C:\Users\Timothy\Desktop\Unity Projects\Git Stuffs\CHC_PoC\Assets\Opsive\UltimateCharacterController\Scripts\ThirdPersonController\Items\ThirdPersonMeleeWeaponProperties.cs:30
 
(Filename: C:/Users/Timothy/Desktop/Unity Projects/Git Stuffs/CHC_PoC/Assets/Opsive/UltimateCharacterController/Scripts/Items/ItemPerspectiveProperties.cs Line: 47)

NullReferenceException: Object reference not set to an instance of an object
  at Opsive.UltimateCharacterController.Items.Actions.ItemAction.Awake () [0x00031] in C:\Users\Timothy\Desktop\Unity Projects\Git Stuffs\CHC_PoC\Assets\Opsive\UltimateCharacterController\Scripts\Items\Actions\ItemAction.cs:58
  at Opsive.UltimateCharacterController.Items.Actions.UsableItem.Awake () [0x00001] in C:\Users\Timothy\Desktop\Unity Projects\Git Stuffs\CHC_PoC\Assets\Opsive\UltimateCharacterController\Scripts\Items\Actions\UsableItem.cs:121
  at Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon.Awake () [0x00001] in C:\Users\Timothy\Desktop\Unity Projects\Git Stuffs\CHC_PoC\Assets\Opsive\UltimateCharacterController\Scripts\Items\Actions\MeleeWeapon.cs:282
 
(Filename: C:/Users/Timothy/Desktop/Unity Projects/Git Stuffs/CHC_PoC/Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ItemAction.cs Line: 58)

Registered PhotonView: 1
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Photon.Pun.PhotonNetwork:RegisterPhotonView(PhotonView) (at C:\Users\Timothy\Desktop\Unity Projects\Git Stuffs\CHC_PoC\Assets\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:925)
Photon.Pun.PhotonView:Awake() (at C:\Users\Timothy\Desktop\Unity Projects\Git Stuffs\CHC_PoC\Assets\Photon\PhotonUnityNetworking\Code\PhotonView.cs:266)
 
(Filename: C:/Users/Timothy/Desktop/Unity Projects/Git Stuffs/CHC_PoC/Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs Line: 925)

System memory in use before: 118.5 MB.
System memory in use after: 118.7 MB.

Unloading 3 unused Assets to reduce memory usage. Loaded Objects now: 3031.
Total: 7.441900 ms (FindLiveObjects: 0.392600 ms CreateObjectMapping: 0.097900 ms MarkObjects: 6.926600 ms  DeleteObjects: 0.024000 ms)
 

StripeStooge

New member
I take it back, in my meddling I have encountered a new error being reported that occurs before that one. My apologies.

Code:
UnassignedReferenceException: The variable ObservedComponents of PhotonView has not been assigned.
You probably need to assign the ObservedComponents variable of the PhotonView script in the inspector.
Photon.Pun.PhotonView.SerializeComponent (UnityEngine.Component component, Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:368)
Photon.Pun.PhotonView.SerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:330)
Photon.Pun.PhotonNetwork.OnSerializeWrite (Photon.Pun.PhotonView view) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1586)
Photon.Pun.PhotonNetwork.RunViewUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1515)
Photon.Pun.PhotonHandler.LateUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:155)
 

Justin

Administrator
Staff member
You are getting an error in Item.cs on line 193. This will happen if the item hasn't been added to the character. I would first get the scene working without any items at all and then add to it from there. You should remove any items from your character and the scene.

I take it back, in my meddling I have encountered a new error being reported that occurs before that one. My apologies.

Code:
UnassignedReferenceException: The variable ObservedComponents of PhotonView has not been assigned.
You probably need to assign the ObservedComponents variable of the PhotonView script in the inspector.
Photon.Pun.PhotonView.SerializeComponent (UnityEngine.Component component, Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:368)
Photon.Pun.PhotonView.SerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:330)
Photon.Pun.PhotonNetwork.OnSerializeWrite (Photon.Pun.PhotonView view) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1586)
Photon.Pun.PhotonNetwork.RunViewUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1515)
Photon.Pun.PhotonHandler.LateUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:155)
That is a Photon specific error that I haven't seen before. You could try asking about it on their forum.
 

StripeStooge

New member
You are getting an error in Item.cs on line 193. This will happen if the item hasn't been added to the character. I would first get the scene working without any items at all and then add to it from there. You should remove any items from your character and the scene.


That is a Photon specific error that I haven't seen before. You could try asking about it on their forum.
Alright, I have already fixed the PhotonView error. I had a couple of empty observed components. Upon removing all items as well as the empty observed components, the look source error has vanished on the local side.

In the process of debugging, I found out that whenever I redid the Object Setup in your PUN Multiplayer Add-On menu after making changes to the player or the items, it would add an empty component to the Observed components list.

I don't know if this is because I shouldn't do that every time I make changes, or if this is an error.

Upon building for an additional client, the Looksource error reappeared for the local player, but not the remote player.

However, Multiplayer is working now, I can see the other player, and everything appears to be working fine, aside from the Looksource error on the Local Player.

Here's the console info:
Code:
Error: There is no look source attached to the character. Ensure the character has a look source attached (such as a camera).
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.ThirdPersonController.Character.MovementTypes.Combat:GetDeltaYawRotation(Single, Single, Single, Single) (at Assets/Opsive/UltimateCharacterController/Scripts/ThirdPersonController/Character/MovementTypes/Combat.cs:32)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:GetDeltaYawRotation() (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:196)
Opsive.UltimateCharacterController.Game.KinematicCharacter:FixedMove(Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:200)
Opsive.UltimateCharacterController.Game.KinematicObjectManager:FixedUpdate() (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:751)
 

Justin

Administrator
Staff member
So the look source is the only error now? You can now debug by placing a breakpoint within NetworkCharacterLocomotionHandler.Start to see if it successfully attaches the character to the camera.
 

StripeStooge

New member
Okay, frankly I don't entirely get how the breakpoints work, but I did get one made, and it does appear that the camera is successfully attached, but that error's got me suspicious regardless.
 

Justin

Administrator
Staff member
When the camera is attached does the OnAttachedLookSource event get executed on the Combat MovementType?
 

StripeStooge

New member
When the camera is attached does the OnAttachedLookSource event get executed on the Combat MovementType?

As far as I can tell, yes, it just appears to be delayed and spitting out an error for whatever reason.

Currently I've cautiously moved on with development, as this doesn't appear to be game breaking anymore. Just gonna stay skeptical. Thanks for the help.
 

wizard

New member
I got the same error once I applied the switching between two characters using this script:
Please see the screenshot attached.
However, it doesn't ruin the game process for me either.
 

Attachments

  • 2020-05-07_03-11-58.png
    2020-05-07_03-11-58.png
    997.2 KB · Views: 13

clarson

New member
I'm having this same issue - it would appear that GetDeltaYawRotation within Combat class is getting called BEFORE OnAttachLookSource in the UltimateCharacterLocomotion class. Because of that GetDeltaYawRotation logs the error because it needs the looksource and it is null at that time.

Note, this only happens for me when I start the level without going through a "menu" level to initiate the connection. I have setup a script that sets up the connection in offline mode when I run the level directly in the editor so that I can test without having to load from a menu. That's probably changing some order, but it makes me think that things are working normally because things just happen to get called in the correct order in other situations.
 
Last edited:

Justin

Administrator
Staff member
For local players the NetworkCharacterLocomotionHandler will attach the camera within Start. This should be executed before the player loop actually gets called.
 

wizard

New member
For local players the NetworkCharacterLocomotionHandler will attach the camera within Start. This should be executed before the player loop actually gets called.

Justin, please help. Still cannot get it working while using the converting functions of SpawnCharacter.cs.
I use just two characters (ValkyrieX and AceNolan) for now and try to get the switching between them working properly.
I edited the functions for my purpose. I am using just one camera for both characters.
Please check the screenshot:

Here is what is going on and how I reproduce the problem situation:
1. Local Look Source is disabled for the first character (ValkyrieX) and its Target is the second character (AceNolan)
Local Look Source is enabled for the second character (AceNolan) and its Target is the first character (ValkyrieX)
Everything works fine. ValkyrieX is playable and AceNolan(AI) is following ValkyrieX.

2. Switching to AceNolan using the ConvertPlaybleToAiAgent(ValkyrieX)/ConvertAiAgentToPlayable(AceNolan) functions.
Everything still works fine. ValkyrieX is following AceNolan.

3. Switching to ValkyrieX using the ConvertPlaybleToAiAgent(AceNolan)/ConvertAiAgentToPlayable(ValkyrieX) functions.
Got that error here. AceNolan doesn't follow ValkyrieX despite its Local Look Source was enabled once again.

4. Switching back to ValkyrieX ruins its Local Look Source the same way.
 

Justin

Administrator
Staff member
I believe that this is fixed in the version being released shortly. At least it was for one project that I tested. This related to the script execution order - the SpawnManagerBase should execute before the KinematicObjectManager.
 

wizard

New member
I believe that this is fixed in the version being released shortly. At least it was for one project that I tested. This related to the script execution order - the SpawnManagerBase should execute before the KinematicObjectManager.
Is it 2.2.3?
 
Top