Unity 2022 supports multiplayer games. The easiest ways are:
Netcode for GameObjects (Unity's built-in multiplayer tool) — good for co-op games.
Photon PUN 2 (very popular, free for small games) — easier for beginners.
Mirror (open-source, powerful but a bit more manual setup).
If you and your friend both work on the same Unity project, and want multiplayer, you can:
Set up a host and client system (one hosts the game, the other joins).
Or use dedicated servers later when you’re more advanced.
You’ll also need to learn basic networking (sending player positions, syncing actions, etc.), but it’s doable, especially for small 2-player games.