NetworkBehaviour Attributes not working (Netcode for game Objects)

Issue #933 invalid
Dylan Welgemoed created an issue

1. What happened?

I can’t seem to see my functions button that I have put on my class that derives from Network Behaviour.

Not sure if this is an actual bug but there is not really any good documentation around this I could find.

2. How can we reproduce it?

Create a public void MyFunc within a class that derives from network behaviour class from the netcode for game objects.
Add the [Button] attribute above function.

3. If screenshots would help explain or demonstrate your issue, please include these.

4. What version of Unity are you using?

2021.3.25f1

5. What version of Odin are you using? (See "Tools > Odin Inspector > About")

3.1.12.2

6. Do you have Editor Only mode enabled?

No

7. What operating system are you on?

Windows

Comments (1)

  1. Antonio Rafael Antunes Miranda

    NetworkBehaviours come with their own custom editors. Odin chooses not to override custom editors. This means your NetworkModuleSpawner isn't drawn by Odin. To regain Odin functionality, you can create an empty custom OdinEditor. However, be aware that this will override the default editor for NetworkBehaviour, losing any features it provides. Here's how to re-enable Odin:

    [CustomEditor(typeof(NetworkBehaviour), editorForChildClasses: true)]
    public class NetworkBehaviourEditor : OdinEditor {}
    
  2. Log in to comment