Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

NCW operations corrupting Forge source #103

Closed
Relic opened this issue Oct 7, 2017 · 4 comments
Closed

NCW operations corrupting Forge source #103

Relic opened this issue Oct 7, 2017 · 4 comments

Comments

@Relic
Copy link
Contributor

Relic commented Oct 7, 2017

Version Number and Operating System(s):

Windows 10 Pro, Forge version 23.0, Unity 2017.1.0p4

Expected behavior:

Creating, modifying and deleting NetworkBehaviors doesn't corrupt/crash the NCW, Unity or any source code generated by Forge or otherwise.

Actual behavior:

Occasionally making a change to NetworkBehaviors in the NCW will cause critical errors in the Unity Editor, resulting in NCW never displaying NetworkBehaviors and the following error being generated after restarting Unity:

ArgumentNullException: Argument cannot be null.
Parameter name: element
System.Attribute.CheckParameters (System.Object element, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:66)
System.Attribute.GetCustomAttribute (System.Reflection.MemberInfo element, System.Type attributeType, Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:151)
System.Attribute.GetCustomAttribute (System.Reflection.MemberInfo element, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:99)
BeardedManStudios.Forge.Networking.UnityEditor.ForgeClassObject..ctor (System.String location) (at C:/git/ForgeNetworkingRemastered/ForgeNetworkingUnityEditor/ForgeClassObject.cs:63)
BeardedManStudios.Forge.Networking.UnityEditor.ForgeNetworkingEditor.ReloadScripts (System.String[] files, System.String[] userFiles) (at C:/git/ForgeNetworkingRemastered/ForgeNetworkingUnityEditor/ForgeNetworkingEditor.cs:946)
BeardedManStudios.Forge.Networking.UnityEditor.ForgeNetworkingEditor.Initialize () (at C:/git/ForgeNetworkingRemastered/ForgeNetworkingUnityEditor/ForgeNetworkingEditor.cs:276)
BeardedManStudios.Forge.Networking.UnityEditor.ForgeNetworkingEditor.Init () (at C:/git/ForgeNetworkingRemastered/ForgeNetworkingUnityEditor/ForgeNetworkingEditor.cs:159)

Steps to reproduce:

I was unable to produce any reliable steps to reproducing it, however it happened just after the following steps modifying a NetworkBehavior to remove the properties and add an RPC method in this order:

  1. Added the RPC, saved & compiled. The RPC method did not add (going back into the behavior in the NCW showed there was no RPC method).
  2. Removing all properties, and saving & compiling worked as expected (NCW showed no properties on the behavior).
  3. Added the RPC again, saved & compiled. The RPC method did not add (again going back into the behavior in NCW).
  4. Restarted Unity resulting in the error pasted above.

Steps to fix from Unity editor:

  1. Delete the generated classes (name)Behavior.cs and (name)NetworkObject.cs and then follow the resulting errors and remove all code related to these two classes.
  2. Restart Unity and the NCW should display all other NetworkBehaviors and work as expected.

[Optional] Discord Username:

Relic#4678

@Sekair
Copy link

Sekair commented Oct 18, 2017

I have the same problem, but i dont have any workarounds that works for me.
I just delete all precreated object in wizard and create my own. From that point i cant see any NetworkObject in wizard. If i open it i catch exception like below and see nothing in wizard tab.
I tried to delete and reimport project from asset store, it doesn't help.

ArgumentNullException: Argument cannot be null.
Parameter name: element
System.Attribute.CheckParameters (System.Object element, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:66)
System.Attribute.GetCustomAttribute (System.Reflection.MemberInfo element, System.Type attributeType, Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:151)
System.Attribute.GetCustomAttribute (System.Reflection.MemberInfo element, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Attribute.cs:99)
BeardedManStudios.Forge.Networking.UnityEditor.ForgeClassObject..ctor (System.String location) (at C:/git/ForgeNetworkingRemastered/ForgeNetworkingUnityEditor/ForgeClassObject.cs:63)
BeardedManStudios.Forge.Networking.UnityEditor.ForgeNetworkingEditor.ReloadScripts (System.String[] files, System.String[] userFiles) (at C:/git/ForgeNetworkingRemastered/ForgeNetworkingUnityEditor/ForgeNetworkingEditor.cs:946)
BeardedManStudios.Forge.Networking.UnityEditor.ForgeNetworkingEditor.Initialize () (at C:/git/ForgeNetworkingRemastered/ForgeNetworkingUnityEditor/ForgeNetworkingEditor.cs:276)
BeardedManStudios.Forge.Networking.UnityEditor.ForgeNetworkingEditor.Init () (at C:/git/ForgeNetworkingRemastered/ForgeNetworkingUnityEditor/ForgeNetworkingEditor.cs:159)

image

@Nimuecrypto
Copy link

I have experienced this, and the only solution seems to be to restart the editor. Often times I cannot even close the broken NCW window.

@NFMynster
Copy link
Collaborator

Make sure your project can compile, that should fix the NCW. Join the discord for more help!

@mcguinnessdr
Copy link
Collaborator

If your project can't compile due to any code errors, including unimplemented RPCs that you have just added, the NCW won't work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants