-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: no longer requires hook to be the first overload in a class (#1913)
* test for sync var hook order * adding extension method * allowing hook method to be in any order * adding second hard to test functions
- Loading branch information
1 parent
e9d9bae
commit 0348699
Showing
7 changed files
with
91 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
.../Tests/Editor/Weaver/WeaverSyncVarHookTests~/FindsHookWhenOverMethodsWithSameNameExist.cs
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
.../Mirror/Tests/Editor/Weaver/WeaverSyncVarHookTests~/FindsHookWithOtherOverloadsInOrder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Mirror; | ||
using UnityEngine; | ||
|
||
namespace WeaverSyncVarHookTests.FindsHookWithOtherOverloadsInOrder | ||
{ | ||
class FindsHookWithOtherOverloadsInOrder : NetworkBehaviour | ||
{ | ||
[SyncVar(hook = nameof(onChangeHealth))] | ||
int health; | ||
|
||
void onChangeHealth(int oldValue, int newValue) | ||
{ | ||
|
||
} | ||
|
||
void onChangeHealth(Vector3 anotherValue, bool secondArg) | ||
{ | ||
|
||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.../Tests/Editor/Weaver/WeaverSyncVarHookTests~/FindsHookWithOtherOverloadsInReverseOrder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Mirror; | ||
using UnityEngine; | ||
|
||
namespace WeaverSyncVarHookTests.FindsHookWithOtherOverloadsInReverseOrder | ||
{ | ||
class FindsHookWithOtherOverloadsInReverseOrder : NetworkBehaviour | ||
{ | ||
[SyncVar(hook = nameof(onChangeHealth))] | ||
int health; | ||
|
||
void onChangeHealth(Vector3 anotherValue, bool secondArg) | ||
{ | ||
|
||
} | ||
|
||
void onChangeHealth(int oldValue, int newValue) | ||
{ | ||
|
||
} | ||
} | ||
} |