Error
The whole answer can be found below.
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).
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.
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(
Fusion.NetworkRunner:ShutdownWithException(Exception)
Fusion.
System.Threading.Tasks.TaskCompletionSource`1:TrySetException(Exception)
Fusion.
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(
Fusion.CloudServices:HandleStartMessage(Int32, Start)
Fusion.<>c__DisplayClass21_0`1:
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
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.
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
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] 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+
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in
at Fusion.NetworkRunner+
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
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.
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
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".
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