mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
test for #3129
This commit is contained in:
parent
3d471db938
commit
bb17920791
@ -34,6 +34,11 @@ class SyncVarNetworkBehaviour : NetworkBehaviour
|
||||
[SyncVar]
|
||||
public SyncVarNetworkBehaviour value;
|
||||
}
|
||||
class SyncVarSetByRef : NetworkBehaviour
|
||||
{
|
||||
[SyncVar]
|
||||
public int value;
|
||||
}
|
||||
class SyncVarAbstractNetworkBehaviour : NetworkBehaviour
|
||||
{
|
||||
public abstract class MockMonsterBase : NetworkBehaviour
|
||||
@ -420,5 +425,22 @@ public void TestSyncingAbstractNetworkBehaviour()
|
||||
Assert.That(clientBehaviour.monster1, Is.EqualTo(serverBehaviour.monster1), "Data should be synchronized");
|
||||
Assert.That(clientBehaviour.monster2, Is.EqualTo(serverBehaviour.monster2), "Data should be synchronized");
|
||||
}
|
||||
|
||||
// test to prevent https://github.com/vis2k/Mirror/issues/3129
|
||||
[Test]
|
||||
public void SyncsIfSetByRef()
|
||||
{
|
||||
CreateNetworkedAndSpawn(
|
||||
out _, out _, out SyncVarSetByRef serverObject,
|
||||
out _, out _, out SyncVarSetByRef clientObject);
|
||||
|
||||
// set it by ref on the server
|
||||
void Setter(out int value) => value = 42;
|
||||
Setter(out serverObject.value);
|
||||
|
||||
// should sync to client
|
||||
ProcessMessages();
|
||||
Assert.That(clientObject.value, Is.EqualTo(42));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user