Do you need to pay a unity server to make hosts made by the players? Like in Minecraft where you host your own server.
Only if you don’t want people to have to pass ip addresses to each other. The whole “hosting” thing is several different kinds of solutions under the same name.
Sounds like you are looking for a Relay Server.
A relay server will reduce ping times and allow for things like host migration and people being able to find a server in a list and connect to it without worrying about firewall issues or ip addresses. In this case the “server” is still actually one of the players, but the relay handles where traffic goes.
But if you just want to do some quick mp with no costs, you do not need a relay or anything, just pass the IP address of the server to someone and they can connect to you (assuming you both have firewall permissions if needed) - same as LAN, but obviously online. This is the oldest type and similar to minecraft.
When doing mp coding I just pass my IP address and they connect directly and we play/test. But in a real game I would be looking at a relay or dedicated server for my particular needs.
I would like no cost so what do you recommend to do and how do i do it?
The cheapest option is, when player act as server.
But that opens separate cans of worms.
What is the bad side with it? Do you use uNet for it?
Pretty much everyone gets on the Internet today behind a NAT router. Their computer is assigned an IP address which doesn’t actually exist on the Internet. So you need the player hosting the game to log into their router (assuming they even have such access) and manually add a port forwarding rule to direct requests sent to the router’s address on a specific protocol and port range to the computer’s IP address. Then all other players connect to the game by connecting to the public facing IP address of the hosting player’s router.
Doing all that is fairly trivial for people knowledgeable in the basics of networking, but is outside of the skill set of your average gamer.
But do you do that via uNet?
You can, though Unet was deprecated over a year ago so it would be a bit silly to just start learning it now.
Can you use photon free version for hosing that kind of servers? If not what would you recommend?
Photon is a different animal, in that it is centralized around the photon server, which is typically cloud based (though you can host the photon server yourself). I’m not that familiar with every iteration of photon’s offerings, so I can’t say for sure if all of them work the same way, though I’d be surprised if they didn’t. Photon works by clients connecting to the cloud server and joining rooms, each room has typically a small number of players since photon soft limits bytes per second. So its nothing like self hosting a minecraft server.
For Minecraft, the actual gameplay is hosted by one of the players but there are services that allow you to have friends (e.g. on consoles).
Photon has no entirely free options (sorry) but the pricing is very competitive and only per CCU (concurrent users).
If some user should be hosting the game (and saving the world), you could e.g. have a look at Bolt Free, MLAPI and various others.
In my opinion, you won’t get around trying out a few options to find one that fits the way you tackle problems.
Personally I would suggest having a look at Mirror which is a opensource version of uNet which fixes all the bugs in uNet and advances it far beyond the original uNet.