Error

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

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).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Error: InvalidOperationException: Type ControllerPrototype has not been weaved.

squirrel
2022-01-21 19:16:50

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.d__255:MoveNext() (at Fusion/Fusion.Runtime/Runner/NetworkRunner.Matchmaking.cs:702)

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

Fusion.NetworkRunner:ShutdownWithException(Exception)

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

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

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

System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(d__62&)

Fusion.CloudServices:HandleStartMessage(Int32, Start)

Fusion.<>c__DisplayClass21_0`1: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)

Comments

squirrel
2022-01-21 19:23:19

From our NetworkProjectConfig.fusion file:

"AssembliesToWeave": [    
    "Assembly-CSharp",    
    "Assembly-CSharp-firstpass"    
],    

squirrel
2022-01-21 19:42:06

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
2022-01-21 19:54:53

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
2022-01-24 17:10:52

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

Nathan
2022-04-14 04:00:45

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?

Nathan
2022-04-19 06:44:59

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] System.InvalidOperationException

See next error log entry for details.

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+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 :0

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

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

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

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

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

UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)

squirrel
2022-04-21 07:40:47

@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    

Roseluck
2022-05-08 15:57:21

squirrel 2022-04-21T07:40:47+00:00

@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.

ramonmelo
2022-06-17 13:05:09

Hi,

Please, just remove completely the "Assets/Photon" folder, import the SDK package again and revert the changes to "NetworkProjectConfig" and "PhotonAppSettings", if necessary.

If you are getting Weaver errors, try to run it again via the Menu at the top "Fusion/Run Weaver".

--

Ramon Melo

Photon Fusion Team

rendre
2022-10-28 23:33:42

Hii.. Have you solve this problem?

I have the same issues, I fixed that by

  • First, Try to add mono-cecil on package manager

  • Second if you use assembly-definition, you need to register them into "NetworkProjectConfig".

pete
2023-02-14 18:06:55

Adding com.unity.nuget.mono-cecil via the package manager solved the issue for us.

For people struggling to get it, check out this SO post: https://stackoverflow.com/questions/71475862/how-to-install-com-unity-mono-nuget-mono-cecil-package-to-unity-project

Back to top