Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ public void WriteObjectPacked(object value)
return;
}


throw new ArgumentException($"{nameof(NetworkWriter)} cannot write type {value.GetType()}");
throw new ArgumentException($"{nameof(NetworkWriter)} cannot write type {value.GetType().Name} - it does not implement {nameof(INetworkSerializable)}");
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,29 @@ public static IEnumerator GetNetworkObjectByRepresentation(Func<NetworkObject, b
}
}

/// <summary>
/// Runs some code, then verifies the condition (combines 'Run' and 'WaitForCondition')
/// </summary>
/// <param name="workload">Action / code to run</param>
/// <param name="predicate">The predicate to wait for</param>
/// <param name="maxFrames">The max frames to wait for</param>
public static IEnumerator RunAndWaitForCondition(Action workload, Func<bool> predicate, int maxFrames = 64)
{
var waitResult = new CoroutineResultWrapper<bool>();
workload();

yield return Run(WaitForCondition(
predicate,
waitResult,
maxFrames: maxFrames));

if (!waitResult.Result)
{
throw new Exception();
}
}


/// <summary>
/// Waits for a predicate condition to be met
/// </summary>
Expand Down
Loading