MirrorNetworking / MirrorNetworking/Mirror
Setting a SyncVar in a Generic results in an error
Open
@miwarnec is already working on this.
Since Nov 17, 2023.
bug
Weaver
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 870
- PR merge metrics
- No merged PRs in 30d
Description
public class Base<T> : NetworkBehaviour
{
[SyncVar] public bool syncvar;
public Base() { syncvar = true; }
}
results in the following error:
Modifying a [SyncVar] from another assembly is not supported. -- both assemblies printed in the error are the same assembly
despite the error, derived classes do seem to be working for my use case, the syncvar is set once in Start() on the host and connecting clients somehow see it, I guess because the value is still being serialized even though the setter isn't working
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.