Error: InvalidOperationException: Type ControllerPrototype has not been weaved.

Hi there! I'm working on converting our project from PUN to Fusion.

When starting up a game (Runner.StartGame()), I'm seeing the following error. Unfortunately, I don't see any indication as to what needs to be weaved. There isn't much in the docs regarding weaving or debugging this. I can't put debug logs in the core files (I believe they're packaged binaries and therefore not readable or editable). Can anyone point me in the right direction?

InvalidOperationException: Type ControllerPrototype has not been weaved. Has the assembly Assembly-CSharp been added to NetworkProjectConfig?

Fusion.NetworkBehaviourUtils.GetWeavedAttributeOrThrow (System.Type type) (at Fusion/Fusion.Runtime/Components/NetworkBehaviourUtils.cs:234)

Fusion.NetworkBehaviourUtils.HasStaticWordCount (System.Type type) (at Fusion/Fusion.Runtime/Components/NetworkBehaviourUtils.cs:251)

Fusion.NetworkBehaviourUtils.RegisterStaticCallbacks (System.Type type) (at Fusion/Fusion.Runtime/Components/NetworkBehaviourUtils.cs:179)

Fusion.SimulationBehaviourUpdater.AddType (System.Type type, System.ValueTuple`2[T1,T2] attr) (at Fusion/Fusion.Runtime/Components/SimulationBehaviourUpdater.cs:262)

Fusion.SimulationBehaviourUpdater.BuildTypeOrder (System.Type[] customCallbackInterfaces) (at Fusion/Fusion.Runtime/Components/SimulationBehaviourUpdater.cs:76)

Fusion.NetworkRunner.Initialize (Fusion.NetworkRunnerInitializeArgs args) (at Fusion/Fusion.Runtime/Runner/NetworkRunner.cs:790)

Fusion.CloudServices.HandleStartMessage (System.Int32 sender, Fusion.Protocol.Start start) (at Fusion/Fusion.Runtime/CloudServices/CloudServices.ProtocolMessages.cs:154)

Fusion.NetworkRunner.StartGameModeCloud (Fusion.StartGameArgs args) (at Fusion/Fusion.Runtime/Runner/NetworkRunner.Matchmaking.cs:653)

UnityEngine.Debug:LogException(Exception)

Fusion.Log:Exception(Exception) (at Fusion/Fusion.Common/Log.cs:126)

Fusion.<ShutdownWithException>d__255:MoveNext() (at Fusion/Fusion.Runtime/Runner/NetworkRunner.Matchmaking.cs:702)

System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(<ShutdownWithException>d__255&)

Fusion.NetworkRunner:ShutdownWithException(Exception)

Fusion.<StartGameModeCloud>d__254:MoveNext() (at Fusion/Fusion.Runtime/Runner/NetworkRunner.Matchmaking.cs:680)

System.Threading.Tasks.TaskCompletionSource`1:TrySetException(Exception)

Fusion.<HandleStartMessage>d__62:MoveNext() (at Fusion/Fusion.Runtime/CloudServices/CloudServices.ProtocolMessages.cs:204)

System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<HandleStartMessage>d__62&)

Fusion.CloudServices:HandleStartMessage(Int32, Start)

Fusion.<>c__DisplayClass21_0`1:<RegisterPackageCallback>b__0(Int32, IMessage) (at Fusion/Fusion.Runtime/CloudServices/CloudCommunicator.cs:218)

Fusion.CloudCommunicator:HandleProtocolPackage(Int32, Object) (at Fusion/Fusion.Runtime/CloudServices/CloudCommunicator.cs:116)

Fusion.CloudCommunicator:PushPackage(Int32, Int32, Object) (at Fusion/Fusion.Runtime/CloudServices/CloudCommunicator.cs:156)

Fusion.Photon.Realtime.FusionRelayClient:OnEventHandler(EventData) (at Fusion/Fusion.Realtime/Client/FusionRelayClient.cs:116)

Fusion.Photon.Realtime.LoadBalancingClient:OnEvent(EventData) (at Fusion/Fusion.Realtime/Realtime/LoadBalancingClient.cs:3353)

ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:899)

ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:565)

ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1771)

ExitGames.Client.Photon.PhotonPeer:Service() (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1685)

Fusion.Photon.Realtime.LoadBalancingClient:Service() (at Fusion/Fusion.Realtime/Realtime/LoadBalancingClient.cs:1399)

Fusion.Photon.Realtime.FusionRelayClient:Update() (at Fusion/Fusion.Realtime/Client/FusionRelayClient.cs:265)

Fusion.CloudCommunicator:Service() (at Fusion/Fusion.Runtime/CloudServices/CloudCommunicator.cs:74)

Fusion.CloudServices:Update() (at Fusion/Fusion.Runtime/CloudServices/CloudServices.cs:125)

Fusion.NetworkRunner:Update() (at Fusion/Fusion.Runtime/Runner/NetworkRunner.cs:1343)

Best Answers

  • squirrel
    squirrel
    Answer ✓

    Figured it out!

    I had missed a warning in Unity about NetworkProjectConfig.fusion not being in its default location. I had moved it.

    Interestingly enough, creating NetworkProjectConfig.fusion in its default location ([Project Root]\Assets\Photon\Fusion\Resources\NetworkProjectConfig.fusion) fixes the problem, even though that config file gets ignored. I get this warning now, but everything works fine:

    [Fusion/Config] There are multiple configs, choosing the first one: Assets/BL/Scripts/ThirdParties/Photon/Fusion/Resources/NetworkProjectConfig.fusion
    Assets/Photon/Fusion/Resources/NetworkProjectConfig.fusion
    
  • ramonmelo
    ramonmelo mod
    Answer ✓

    Hi @squirrel ,


    Thanks for reporting. We are still working on how to fully enable files being moved on the project.

    But we are glad that you get it working.


    --

    Ramon Melo

    Photon Fusion Team

Answers

  • From our NetworkProjectConfig.fusion file:

    "AssembliesToWeave": [
        "Assembly-CSharp",
        "Assembly-CSharp-firstpass"
    ],
    
  • Additional information

    Using Unity 2021.2.8f1

    Using Photon-Fusion-0.13.0-RC-Nightly-390

    I've tried running Fusion > Run Weaver a few times, and it doesn't seem to help the situation.

  • squirrel
    squirrel
    Answer ✓

    Figured it out!

    I had missed a warning in Unity about NetworkProjectConfig.fusion not being in its default location. I had moved it.

    Interestingly enough, creating NetworkProjectConfig.fusion in its default location ([Project Root]\Assets\Photon\Fusion\Resources\NetworkProjectConfig.fusion) fixes the problem, even though that config file gets ignored. I get this warning now, but everything works fine:

    [Fusion/Config] There are multiple configs, choosing the first one: Assets/BL/Scripts/ThirdParties/Photon/Fusion/Resources/NetworkProjectConfig.fusion
    Assets/Photon/Fusion/Resources/NetworkProjectConfig.fusion
    
  • ramonmelo
    ramonmelo mod
    Answer ✓

    Hi @squirrel ,


    Thanks for reporting. We are still working on how to fully enable files being moved on the project.

    But we are glad that you get it working.


    --

    Ramon Melo

    Photon Fusion Team

  • Hey team,

    I'm working on importing fusion into my game and I'm having the same issue but as far as I can tell the files are all in the default location and they haven't been moved, anything else I can try?

  • ConnectionStatus=Connecting 

    ConnectionStatus=Starting 

    Starting game with session My name, player limit 10

    DontDestroyOnLoad only works for root GameObjects or components on root GameObjects.

    <color=#144078>[Fusion]</color> System.InvalidOperationException

    <i>See next error log entry for details.</i>

    InvalidOperationException: Type ControllerPrototype has not been weaved. Has the assembly Assembly-CSharp been added to NetworkProjectConfig?

     at Fusion.NetworkBehaviourUtils.GetWeavedAttributeOrThrow (System.Type type) [0x0002b] in <147a77adcf864b659935f862fe8f5e7b>:0 

     at Fusion.NetworkBehaviourUtils.HasStaticWordCount (System.Type type) [0x00000] in <147a77adcf864b659935f862fe8f5e7b>:0 

     at Fusion.NetworkBehaviourUtils.RegisterStaticCallbacks (System.Type type) [0x00026] in <147a77adcf864b659935f862fe8f5e7b>:0 

     at Fusion.SimulationBehaviourUpdater.AddType (System.Type type, System.ValueTuple`2[T1,T2] attr) [0x00018] in <147a77adcf864b659935f862fe8f5e7b>:0 

     at Fusion.SimulationBehaviourUpdater.BuildTypeOrder (System.Type[] customCallbackInterfaces) [0x00086] in <147a77adcf864b659935f862fe8f5e7b>:0 

     at Fusion.NetworkRunner.Initialize (Fusion.NetworkRunnerInitializeArgs args) [0x002c0] in <147a77adcf864b659935f862fe8f5e7b>:0 

     at Fusion.CloudServices+<HandleStartMessage>d__67.MoveNext () [0x000ae] in <147a77adcf864b659935f862fe8f5e7b>:0 

    --- End of stack trace from previous location where exception was thrown ---

     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <a1e9f114a6e64f4eacb529fc802ec93d>:0 

     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <a1e9f114a6e64f4eacb529fc802ec93d>:0 

     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <a1e9f114a6e64f4eacb529fc802ec93d>:0 

     at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <a1e9f114a6e64f4eacb529fc802ec93d>:0 

     at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <a1e9f114a6e64f4eacb529fc802ec93d>:0 

     at Fusion.NetworkRunner+<StartGameModeCloud>d__268.MoveNext () [0x00532] in <147a77adcf864b659935f862fe8f5e7b>:0 

    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)

  • @Nathan are you seeing the warning I mentioned above?

    [Fusion/Config] There are multiple configs, choosing the first one: Assets/BL/Scripts/ThirdParties/Photon/Fusion/Resources/NetworkProjectConfig.fusion
    Assets/Photon/Fusion/Resources/NetworkProjectConfig.fusion
    
  • I get the same 'has not been weaved error' without that error appearing.