-
Notifications
You must be signed in to change notification settings - Fork 459
Closed
Labels
type:bugBug ReportBug Report
Description
Describe the bug
There is no public Add method for the NetworkSet!
To Reproduce
Just write code (it will NOT compile):
- Declare a NetworkSet variable, inside a behaviour or whatever class/file you want to declare. Ensure this new, test, code you are writing is NOT in the same assembly/directory of MLAPI, but in an external directory (e.g. a main Scripts directory in the project root, and the MLAPI in another directory, with its own assembly definition).
- Try invoking yourVariable.Add(anInstanceOfWatever).
- Try compiling.
Actual outcome
A compilation error: 'NetworkSet' does not contain a definition for 'Add' and no accessible extension method 'Add' accepting a first argument of type 'NetworkSet' could be found (are you missing a using directive or an assembly reference?)
Expected outcome
No compilation error.
Environment:
- OS: Windows 10
- Unity Version: 2020.3.12f1
- MLAPI Version: 0.1.1
- MLAPI Commit: ee59d5f (corresponds literally to tag 0.1.1).
Additional context
I notice there are two implementations of Add. One coming from ICollection and one coming from ISet. Both have almost the same code (save for a dumb return true
in the case of ISet implementation, but with no return false
counterpart).
My suggestion is:
- Make them public. At least, one of them (by default they are internal).
- In the
bool ISet<T>.Add
case, at least, ask the result of them_Set.Add
operation. On false, the element is already present and nothing changed: avoid triggering dirtiness / OnSetChanged.
Metadata
Metadata
Assignees
Labels
type:bugBug ReportBug Report