* Deprecate proxy methods for setting playerController.
* shortened obsoleted methods.
* This isnt actually public facing, its internal. Obsoletion is unnecessary, plain removal is ok.
* Change SyncVar hooks to use `nameof`
I intentionally left the test for missing hook as a literal string because it won't compile otherwise.
* Removed unnecessary property value set from hook
Previously, during deserialize, Mirror either called the hook for a syncvar or it set the variable, but never both. So users had to set the variable inside the hook.
```cs
class Player : NetworkBehaviour {
[SyncVar(hook=nameof(OnVarChanged))]
public int myvar;
public void OnVarChanged(int newvalue) {
Debug.Log("Got new value " + newvalue);
Debug.Log("Old value is " + myvar);
// with this pull request the following line is no longer needed
// the weaver will do this after the hook finishes
// this.myvar = newvalue;
}
}
```
fix: Hook not working with NetworkIdentity or GameObjects
Deserializing NetworkIdentity or GameObjects was broken, it called the hook only if there was no hook, and it saved the variable only if there was a hook.
* Made dirty bits not rely on NetworkWriter position manipulation hackery.
* Renamed GetDirtyBits to NextDirtyBits, as discussed with Paul.
* Expanded one line ifs.
* Added basic SyncDictionary support, no support for structs yet
* Fixed TryGetValue usage
* Removed extraneous hardcoded SyncDictionary type
* Added a couple basic tests, more coming
* Added 4 more tests
* Added two tests and SyncDictionary now bubbles item to Callback on Remove (both Remove cases)
* Added the remainder of tests
* Added basic documentation about SyncDictionaries on StateSync.md page
* Simplify test syntax
Co-Authored-By: Katori <znorth@gmail.com>
* Simplify test syntax
Co-Authored-By: Katori <znorth@gmail.com>
* Simplify test syntax
Co-Authored-By: Katori <znorth@gmail.com>
* Simplify test syntax
Co-Authored-By: Katori <znorth@gmail.com>
* Remove null-check when setting value directly (and updated expected test behaviour)
* fix: Provide default implementation for SyncDictionary serializers
* feat: Add Weaver support for syncdictionary
* Fix minor issue with Set code and made test use Weaved serialization instead of manual
* Added a new test for bare set (non-overwrite)
* Added another test for BareSetNull and cleaned up some tests
* Updated SyncDictionary documentation on StateSync.md
* Update docs with SyncDictionary info
* Update SyncDictionary docs wording
* docs: document the types and better example
* Add two SyncDictionary constructors
* Removed unnecessary initialization
* Style fixes
* - Merged many operation cases
- Fixed Contains method
- Added new test to test contains (and flag its earlier improper usage)
- Use PackedUInt32 instead of int for Changes and Counts
* - Simplify "default" syntax
- Use Rodol's remove method (faster)
- Don't use var
* Removed unnecessary newline, renamed <B, T> to <K, V> per vis2k, corrected wording of InvalidOperationException on ReadOnly AddOp
* Code simplification, style fixes, docs example style fixes, newly improved implementation for CopyTo that fails gracefully
* feature(synclist): allow SyncList of primitive types
As it turns out this never really worked:
```cs
class SyncListByte : SyncList<byte> {};
```
You had to write your own serializeItem / deserialize item for native types.
This change lifts the restriction, now you can use a synclist of anything that mirror can serialize/deserialize
* fix: fix unit tests error messages
* - Added a `IMessageBase` as an interface to `MessageBase`. Existing messages which inherit `MessageBase` (including ones which do not implement Serialize/Deserialize and rely on the weaver) will continue to work in exactly the same way as before!
- Modified any methods which were generic `T where T : MessageBase` to be `T where T : IMessageBase`. this does not change things at all for all existing usages of the method.
These two changes allow end users to implement IMessageBase as a `struct` instead of `MessageBase` as a `class`, so they are no longer forced to allocate message objects in their own code.
* Update .gitignore
* Update Messages.cs
* Update MessageBaseTests.cs
* Update MessageBaseTests.cs
* Update MessageBaseTests.cs
Previously, if you wanted a synclist of structures, you would do: SyncListSTRUCT<MyStruct>
Now you can use SyncList<MyStruct>
SyncListSTRUCT is left there, but obsolete
This allows you to leave rotation out of the NetworkTransform if you only need position.
Right now if you don't need sync rotation and set compression to Lots, it can move your object in ways not expected. This forces you to use no compression as a fix. Using more bandwidth for something you don't need. I think this is all that is needed, tested it in my game and it works.
The name SyncObjectProcessor is confusing because it does not process syncobjects. Instead it initializes syncobjects in a NetworkBehaviour.
this avoids the confusion with SyncListStructProcessor, that does process synclists to add serialization methods
SyncListProcessor is a very confusing name, it does not process synclists at all, instead it initializes synclists in the network behaviour.
This is more confusing especially since SyncListStructProcessor does process the synclists to add serialization methods, and both of them normally work
in tandem in different parts of the code
* Fix Scene Handling
Line 361: Passing false prevents the switch to offline scene...pass true instead to forceReload paramater.
Line 588: Never assume Network Manager is in Scene 0 of Build Settings...it often is not.
* Reverted GetActiveScene
Will make separate PR
* Added code to unwind DontDestroyOnLoad
* Fixed typo in comment
* Removed the unwinding of DDOL
* [TargetRPC] optional connection parameter for easier usage while still allowing for previous usage
* allow for parameterless targetrpc too
* syntax
* Add Helpers.ReaderParameters change from HLAPI 2019.2 package just to be sure