Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice

Is unity secretly trying to use my webcam?

Discussion in 'Editor & General Support' started by HiddenMonk, Aug 13, 2020.

  1. HiddenMonk

    HiddenMonk

    Joined:
    Dec 19, 2014
    Posts:
    987
    Unity Version: 2019.4.6f1
    I think it was a IL2CPP build.
    Windows 7 64bit

    So I had a bug and was trying to track it down by looking in the logs. 1 Client running normally, and 1 Client running in sandboxie so I can have 2 Steams running.
    Weirdly, the client that was running in sandboxie (not sure if that affected anything) had this line snuck seemingly randomly in the debug logs, although consistent in when it was placed (When I was changing teams).

    ...
    at UnityEngine.Windows.WebCam.VideoCapture+OnVideoCaptureResourceCreatedCallback.Invoke (UnityEngine.Windows.WebCam.VideoCapture captureObject) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    ...

    Weird, I noticed it and kept it in the back of my mind as I continued to hunt down the bug I was looking for.
    After fixing the bug, I closed shop for the day, and some code changes later I came back to see if there were any WebCam logs in my logs anymore and I dont see any, but I do see something else in its place.

    ...
    at System.Net.SimpleAsyncCallback.Invoke (System.Net.SimpleAsyncResult result) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    ...


    So here is the full Debug Log with the webcam log
    Nx: Player MemberID:# set team to Team2
    at MGameEngine.MConsole+MLoggerHandler.LogFormat (UnityEngine.LogType logType, UnityEngine.Object context, System.String format, System.Object[] args) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at UnityEngine.Logger.Log (System.String tag, System.Object message) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.MConsole.LogExtra (System.Object message) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.GameModeBehaviour.OnPlayerSetTeam (MGameEngine.SyncNet.SyncUniqueID memberID, MGameMode.GameTeam team) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.BasicGameMode.OnPlayerSetTeam (MGameEngine.SyncNet.SyncUniqueID memberID, MGameMode.GameTeam team) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.MGameModeManager.OnPlayerSetTeam (MGameEngine.SyncNet.SyncUniqueID memberID, MGameMode.GameTeam team) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Action`2[T1,T2].Invoke (T1 arg1, T2 arg2) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.ActionHashEvent`2[T,U].Execute (T params1, U params2) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.MemberGameData.SetLeaderDetectedTeam (MGameMode.GameTeam team) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.GameModeBehaviour.SetLeaderDetectedPlayerTeam (System.Collections.Generic.List`1[T] playerTeams) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.GameModeBehaviour.RPCReceive_SetLeaderDetectedPlayerTeam (MGameEngine.SyncNet.SyncStream stream) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at UnityEngine.Windows.WebCam.VideoCapture+OnVideoCaptureResourceCreatedCallback.Invoke (UnityEngine.Windows.WebCam.VideoCapture captureObject) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncIdentity.OnRPCMessage (MGameEngine.SyncNet.SyncIdentityRPCSyncMessage msg) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Action`1[T].Invoke (T obj) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncMessageHandler.ReadMessage (System.UInt16 msgID, MGameEngine.SyncNet.SyncConnection fromConnection, System.Int32 channelID, MGameEngine.SyncNet.SyncStream stream, System.Single& cost) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncConnection.Receive (System.Int32 channelID, MGameEngine.SyncNet.SyncStream stream, System.Boolean startDeserializing) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncClient.OnReceiveData (MGameEngine.SyncNet.SyncReceiveInfo receiveInfo) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Action`1[T].Invoke (T obj) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.ActionHashEvent`1[T].Execute (T params1) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.ActionHashEvent`1[T].TryExecute (T params1) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncSteamTransporter.ReadPackets () <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Action.Invoke () <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.ActionHashEvent.Execute () <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.StaticUpdatesBehaviour.Update () <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0

    Here is the full normal Debug Log
    Nx: Player MemberID:# set team to Team2
    at MGameEngine.MConsole+MLoggerHandler.LogFormat (UnityEngine.LogType logType, UnityEngine.Object context, System.String format, System.Object[] args) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at UnityEngine.Logger.Log (System.String tag, System.Object message) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.MConsole.LogExtra (System.Object message) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.GameModeBehaviour.OnPlayerSetTeam (MGameEngine.SyncNet.SyncUniqueID memberID, MGameMode.GameTeam team) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.BasicGameMode.OnPlayerSetTeam (MGameEngine.SyncNet.SyncUniqueID memberID, MGameMode.GameTeam team) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.MGameModeManager.OnPlayerSetTeam (MGameEngine.SyncNet.SyncUniqueID memberID, MGameMode.GameTeam team) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Action`2[T1,T2].Invoke (T1 arg1, T2 arg2) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.ActionHashEvent`2[T,U].Execute (T params1, U params2) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.MemberGameData.SetLeaderDetectedTeam (MGameMode.GameTeam team) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.GameModeBehaviour.SetLeaderDetectedPlayerTeam (System.Collections.Generic.List`1[T] playerTeams) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameMode.GameModeBehaviour.RPCReceive_SetLeaderDetectedPlayerTeam (MGameEngine.SyncNet.SyncStream stream) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Net.SimpleAsyncCallback.Invoke (System.Net.SimpleAsyncResult result) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncIdentity.OnRPCMessage (MGameEngine.SyncNet.SyncIdentityRPCSyncMessage msg) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Action`1[T].Invoke (T obj) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncMessageHandler.ReadMessage (System.UInt16 msgID, MGameEngine.SyncNet.SyncConnection fromConnection, System.Int32 channelID, MGameEngine.SyncNet.SyncStream stream, System.Single& cost) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncConnection.Receive (System.Int32 channelID, MGameEngine.SyncNet.SyncStream stream, System.Boolean startDeserializing) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncClient.OnReceiveData (MGameEngine.SyncNet.SyncReceiveInfo receiveInfo) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Action`1[T].Invoke (T obj) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.ActionHashEvent`1[T].Execute (T params1) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.ActionHashEvent`1[T].TryExecute (T params1) <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.SyncNet.SyncSteamTransporter.ReadPackets () <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at System.Action.Invoke () <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.ActionHashEvent.Execute () <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0
    at MGameEngine.StaticUpdatesBehaviour.Update () <0x00000 + 0xffffffff> 0 in <00000000000000000000000000000000>:0

    Here is an image of the Diff of the logs
    Diff.png

    Here is the method that is in the log that appears before the weird logs, which is the method SyncIdentity.OnRPCMessage and probably the other important code parts.
    Code (CSharp):
    1. public static void OnRPCMessage(SyncIdentityRPCSyncMessage msg)
    2. {
    3.     SyncIdentity syncIdentity = GetSyncIdentity(...);
    4.     if(...)
    5.     {
    6.         syncIdentity.DeserializeRPC(msg.index, msg.data);
    7.     }else{
    8.         ...
    9.     }
    10. }
    11.  
    12. List<RPCData> rpcDelegates;
    13.  
    14. void DeserializeRPC(int rpcIndex, SyncStream stream)
    15. {
    16.     if(rpcDelegates.HasIndex(rpcIndex))
    17.     {
    18.         rpcDelegates[rpcIndex].method(stream);
    19.         onDeserializeRPC.Execute();
    20.     }
    21. }
    22.  
    23.  
    24.  
    25. public class RPCData<T> : RPCDatas
    26. {
    27.     public T method;
    28.  
    29.     public RPCData(T method, SyncQOS qosType, bool useMultiUnreliable = false, bool requireLobbyReady = false) : base(qosType, useMultiUnreliable, requireLobbyReady)
    30.     {
    31.         this.method = method;
    32.     }
    33. }
    34. public class RPCData : RPCData<RPCDelegate>
    35. {
    36.     public RPCData(RPCDelegate method, SyncQOS qosType, bool useMultiUnreliable = false, bool requireLobbyReady = false) : base(method, qosType, useMultiUnreliable, requireLobbyReady) {}
    37. }

    Now, I doubt unity is trying to spy on me or anything, but I do not know why I had that webcam log, and if a user had seen this in their logs, theyd probably not give me the benefit of the doubt and assume I am trying to do something fishy.

    It was always when changing teams, so it was random that it happened when changing teams, but it was consistent in that it was always when changing teams.

    I do not see it happen anymore, maybe I should try to put back the bug I was hunting, but I dont see how that would cause this in the first place as it seems completely irrelevant. I am pretty sure no where am I doing any webcam stuff.

    I also don't have a webcam.
     
    Last edited: Aug 13, 2020
unityunity