# Misprediction and Server Reconciliation Example

**URL:** <https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582>\
**Category:** Help\
**Created:** [September 5, 2024, 4:58am UTC](https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582 "2024-09-05T04:58:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AceGames](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/acegames/32/542_2.png) [@AceGames](https://community.coherence.io/u/AceGames)\
**Post date:** [September 5, 2024, 4:58am UTC](https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582/1 "2024-09-05T04:58:42Z")

</div>

Hi, just trying out the example for Misprediction and Server Reconciliation, but having errors with the code example from here [Server-authoritative setup | Unity Multiplayer SDK Documentation | coherence](https://docs.coherence.io/manual/authority/server-authoritative-setup). Do you know what I might be doing wrong?

 ![coherence_01](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/528d7674e85e4e1d99e3075a214b1aafe19d972f.jpeg)  
 ![coherence_02](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/e9dfe1eff3fdb54fa375dd10a01d5351cb44c997.jpeg)

Also does this example cover rotation reconciliation or just position? If not how would you add that?

Many thanks coherence team 👍

---

<div class="post-metadata">

**Author:** ![Filip](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/filip/32/142_2.png) [@Filip](https://community.coherence.io/u/Filip)\
**Post date:** [September 5, 2024, 7:42am UTC](https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582/2 "2024-09-05T07:42:41Z")

</div>

Hey!

What you’re missing is the import of `System.Linq`. Please add this somewhere next to existing `usings`:

```auto
using System.Linq;

```

The `FirstOrDefault` is an extension method that’s defined in the `Linq` namespace. We forgot to mention this in the example. I’ll make sure this gets fixed.

> Also does this example cover rotation reconciliation or just position? If not how would you add that?

I believe the approach would be identical to position - you’ll want to find the “rotation” binding (make sure it is bound via `CoherenceSync` configuration first) and subscribe to its sample receive event. Then in the callback you can calculate the difference in angle between predicted and received values and make a correction if needed.

---

<div class="post-metadata">

**Author:** ![AceGames](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/acegames/32/542_2.png) [@AceGames](https://community.coherence.io/u/AceGames)\
**Post date:** [September 5, 2024, 11:41pm UTC](https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582/3 "2024-09-05T23:41:10Z")

</div>

Great thank you very much. 👍

---

<div class="post-metadata">

**Author:** ![AceGames](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/acegames/32/542_2.png) [@AceGames](https://community.coherence.io/u/AceGames)\
**Post date:** [September 6, 2024, 2:51am UTC](https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582/4 "2024-09-06T02:51:26Z")

</div>

Ok that has cleared, that error. but now I have a new one:

Assets\Coherence\_prediction.cs(13,3): error CS0123: No overload for ‘DetectMisprediction’ matches delegate ‘Action\<object, bool, long\>’

any thoughts?

---

<div class="post-metadata">

**Author:** ![ciro](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/ciro/32/82_2.png) [@ciro](https://community.coherence.io/u/ciro)\
**Post date:** [September 12, 2024, 9:38am UTC](https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582/5 "2024-09-12T09:38:35Z")

</div>

Hi AceGames. Apparently the sample on that page is a bit outdated, as the Action you’re listening to has a new signature. (as you can see from the error message you’re getting)

Instead of:

```auto
private void DetectMisprediction(object sampleData, long simulationFrame)

```

try:

```auto
private void DetectMisprediction(object sampleData, bool stopped, long simulationFrame)

```

(you can ignore that incoming `stopped` parameter for now).

And ~~I’ll fix~~ **I fixed** the docs, so we don’t get this issue again… sorry for the inconvenience!

---

<div class="post-metadata">

**Author:** ![AceGames](https://dub1.discourse-cdn.com/flex017/user_avatar/community.coherence.io/acegames/32/542_2.png) [@AceGames](https://community.coherence.io/u/AceGames)\
**Post date:** [September 13, 2024, 3:28am UTC](https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582/6 "2024-09-13T03:28:53Z")

</div>

Awesome yea that has cleared all the errors now, thanks very much.

All the best 👍

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex017/uploads/coherence/original/1X/b3aa79eb9519fac7aad7eba18f15a1e8ce60f6e2.png) [@system](https://community.coherence.io/u/system)\
**Post date:** [December 12, 2024, 3:29am UTC](https://community.coherence.io/t/misprediction-and-server-reconciliation-example/582/7 "2024-12-12T03:29:01Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
