'Unity C# Card game - 2-4 players, one canvas
I have created an app for a word game played with cards (2D turn-based). I'm trying to make a multiplayer version, with 2-4 players having their own views of the same cards.
I copied a lobby system from a Dapper Dino tutorial, but the host and client get two distinct apps, each with its own copy of the canvas.
I tried using a Network List to save the order of the cards shuffled by the host…
public NetworkList<int> ShuffleOrder;
...
for (int i = FullDeck.Length - 1; i > 0; i--)
{
swap = UnityEngine.Random.Range(0, i);
c = FullDeck[swap];
FullDeck[swap] = FullDeck[i];
FullDeck[i] = c;
thisCard.pos = swap;
ShuffleOrder.Add(FullDeck[i].origOrder);
}
… but the clients did not get the host's list values.
I've tried the Unity web site, but right now all my searches lead to the deprecated old multiplayer documentation or "page not found". I've watched three playlists on YouTube (msfarzan/Mirror, DapperDino/PUN, Dilmer) but couldn't figure out how to make my app work with them.
Here are links to screenshots of what it looks like in the Unity editor (sorry if it's too small) and of a game in progress:
http://deanhoward.us/AnimAbet1.jpg
http://deanhoward.us/AnimAbet2.jpg
(I can add a link to a page with the solo app, if the rules allow that.)
It seems like connecting the clients and canvas shouldn't be hard (followed by tons of time to make everything work), but I've spent many hours trying things that don't work. Do I just need a small fix, or a completely different approach. Many thanks for anything you can tell me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
