Skip to content

Difficulties to extend the SDK due to tight accessors #2678

@PitouGames

Description

@PitouGames

Hello,
I wanted to create a ManagedNetworkList and a ManagedNetworkArray, which works like the NetworkList but allows to store managed objects that implement the INetworkSerializable interface.

My issue is that some functions and properties used in your NetworkList are internal, so I can't use them from my script:

In the codegen, only types used in NetworkVariable and NetworkList are processed:
https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/b5b8edae4af1aba810bf07efc7f300c2d28a2623/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs#L1149C25-L1149C25

You can try to move the NetworkList outside of the package folder and you will see the problem I had.

I ended up having the simplest solution: add those new ManagedNetworkList and ManagedNetworkArray directly in my fork.

I also wanted to make my own NetworkBehaviourReference<T> struct where T is a derived type of the referenced NetworkBehaviour.
NetworkObject.GetNetworkBehaviourAtOrderIndex() was needed but it's internal...

Is there anything preventing those function to be public? Could you "Unrestrict" the codegen?
Do you have any recommendations to extend the SDK?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:feedbackIssue contains feedback and not specific bug or feature requests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions