Hello ! i am discovering Unity and coding in general. I want to make a little 2d online board game where the board is randomly generated and of course is the same for every player. Thats why i think i should use network for gameobjects with Relay to spawn a prefab "box" and change its sprite randomly (because i'm a beginner i can be wrong thinking like that). I tried it following some tuto but right now i'm stuck, i can generate a correct board when the host start the game (clients are already connected) but only the host will see my board. I cant synchronize this board with clients and don't know what to do (screenshot show how i did it). What can i have done wrong: -networkManager: in a tuto i saw that i have to make a list of prefabs for the networkmanager but it isn't the gameobject my networkmanager is attached that will spawn by box maybe its a problem
-Prefabbox: only network object(ownership set to none maybe is a problem) a script and a sprite renderer are attached to this prefab maybe i forgot a component
-Box: they are not in the hierarchy so i instantiate them with the server. maybe thats why they only appear on the host side.
Some precisions: i'm french so Case = box, i know the function generateboardwhe ready is useless if i call genererateboard after spawnboard i made it before spawnboard, i already tried to connect two player and made them control their ball just to test and it work.
If someone could help me it will be very kind to do so. Just in case i don't know if i'm using the right channel. Sorry if i'm wrong !
#Get a random board
1 messages · Page 1 of 1 (latest)
You can't spawn network objects as child objects.
I would use a seed value have the clients generate the board from that seed.
thank you i will try that. i just have to find a tuto up to date
may i ask you some questions:
-i think i sould use a networkvariable and listeners so clients know when they can generate their board and with which seed. Is this right ?
-because every clients will generate their board its better to create a new object "spawnmanager" that everyone will have and that will communicate with the gamemanger to know when he can spawn everything ?
-if yes what will have a network object component ? spawnmanager,gamemanager,boxprefab ?