Skip to main content
8 votes
Accepted

How can I use websockets in a Unity WebGL project?

As the documentation says, The Unity scripting API does not expose direct WebSocket access itself. But you can access the native web browser API by calling JavaScript from Unity C# scripts. Create a ...
Philipp's user avatar
  • 122k
4 votes

How to store and retrieve user data in a multiplayer game

Unity does not include a server side persistence solution out of the box. As far as I can tell the only storage solution Unity includes is PlayerPerfs, but that is client side. However that does not ...
Theraot's user avatar
  • 27.5k
4 votes

Difference between [P2P] Relay Servers and Dedicated Game Servers?

In the peer-to-peer client-server model, the server software runs on the machine of a player who is also taking part in the game. The server software and the game client are usually integrated in the ...
Philipp's user avatar
  • 122k
4 votes
Accepted

How can I secure my data in Unity?

What is in clients hand is by definition not secret anymore. Regardless what you do, if they are dedicated enough they can get the information that is located inside the client. Instead why not let ...
Zibelas's user avatar
  • 4,628
3 votes
Accepted

Why nobody creates shared world games?

Yes there are games, and yes there are problems. Listen, light has a set speed. Even if the connection were at light speed all the way from client to server (which probably it isn't), it takes time ...
Theraot's user avatar
  • 27.5k
3 votes

Is this enough calculation on server-side to be secure?

Is wrong. Changing states of objects is trusting the client. Depending on what that object does, nothing would prevent the client from keeping it alive or setting it dead. The question does not state ...
Zibelas's user avatar
  • 4,628
2 votes
Accepted

Unity Network Flip sprite renderer

[ClientRpc] functions are only called from the host. For the Client to send to the Host, you need a [Command] function, or serialize a variable.
Stephan's user avatar
  • 1,728
2 votes
Accepted

Random Disconnects on UNET

you can try changing delay value in Network Manager from 0.01 to any higher value. 0.9 worked normally for me.
Nick's user avatar
  • 561
2 votes
Accepted

How to give and remove authority of an object between multiple clients (Or how to let the client controller push a rigidbody)

And so here's the script I used to solve this problem. However, if both client and host are sending commands through the object, you'll have a problem when the client has authority. I'll try to solve ...
Studio Pie's user avatar
2 votes
Accepted

Unity Networked gaming 2019... What happened to NetworkBehaviour, OnServerStart() etc

As of right now, there is no production ready replacement for UNET. UNET is currently deprecated. UNET has four main components, HLAPI, LLAPI, relay server, and legacy matchmaking. The HLAPI will be ...
Landon's user avatar
  • 141
2 votes

Prevent multiple input packets to authoritative server

Have clients stamp their input packets with the index of the 30 Hz input window to which they correspond. On the server, keep a bitmask of windows for which you've received input from each client. You ...
DMGregory's user avatar
  • 136k
2 votes
Accepted

Synvar not syncing when Instantiating gameObject

I found a workaround using netIds. I think the problem was that when I tried to sync the gameobject, it wasn't spawned yet on the client, so it was null. ...
ToltottKaposzta's user avatar
1 vote
Accepted

Enter in a match that is already started

First and foremost no, you may not add players to an already started game with lobbies because they were designed to host short term games with a set number of players. Because of the rigid structur ...
TurtleKwitty's user avatar
1 vote

Getting ip address of connected network

You cannot simply get the server's IP from the client. There is no way to do that without using some kind of service discovery system. That is why we have server browsers in most games. They provides ...
Qu3tzalify's user avatar
1 vote

problem using OnStartServer() for unity multiplayer networked game

OK well I found a workaround style solution. I also came across some info here https://forum.unity.com/threads/when-awake-will-be-call-for-game-object-with-networkidentity.441678/ , which states ...
Big T Larrity's user avatar
1 vote

Unity UNET, problems spawning and then destroying that instantiated prefab

On UNET, when you Instantiate and Destroy Objects (or deactivate, if such the case), you must make use of Spawn and Unspawn respectively, so those objects appear / dissapear on the other clients. You ...
LifGwaethrakindo's user avatar
1 vote

Weapon Switching - Unity 3d

I think the probles is that you are not calling the server after you change the Weapon's index, after you change the index, you must deactivate all weapon childs and just activate the one in the index,...
LifGwaethrakindo's user avatar
1 vote

How to release a new level without having to publish a new version

When your levels are defined in sourcecode, then you can't add more levels without releasing a new version of the complete game build. So instead of hardcoding your level setups, move the layout of ...
Philipp's user avatar
  • 122k
1 vote

When creating a game, what are some architectural desgin concepts I can use to be able to port my game from single to multiplayer?

Depends on the size of the project. For small projects like the ones described in the question, it's not worth the effort. Constantly worrying about large but possibly non-existent problems can slow ...
Peter's user avatar
  • 9,955
1 vote
Accepted

Unity/UNet without a lobby: How do you get an ordered list of participants (network players)?

as long as you are inheriting a network behavior you can run a check if (isLocalPlayer) add to list. Or you can override the ...
Justin Markwell's user avatar
1 vote

Using unity app how to read the asset in android SDCard?

To solve this problem I created pre-compilation script which will run before the compilation; this script will list the names of the files you want to access later in text file ...
Shady Mohamed Sherif's user avatar
1 vote

Why is the ownership fixed when synching objects?

I can't say why the ownership is fixed. But that being the case I'd suggest making two cue balls, one owned by each client. Only make one visible at a time based on whose turn it is. Then after ...
CLo's user avatar
  • 1,330
1 vote

Send Rate is zero but server movement is still happening

It looks like this API is set up so that a send rate of 0 means "on demand". If you're continually moving an object that's been set to, say, 10 network updates per second, those transform ...
DMGregory's user avatar
  • 136k
1 vote

Unity - DontDestroyOnLoad - FindObjectsOfType(GetType()).Length is always returning 1

Try this. It compares time alive on different instances of the class, ensuring that your first instance will be the one that survives. ...
Samuel Lopes's user avatar
1 vote
Accepted

How do I use Unity's OnPlayerConnected method?

OnPlayerConnected() and OnPlayerDisconnected() are part of the old networking API and not UNET what is currently being used. In ...
Uri Popov's user avatar
  • 3,027
1 vote

How do I use Unity's TargetRPC calls? Trying to send data from the server to a client

It is probably an issue of timing. The error message is telling you that the object to which the TargetRpcTest script is attached exists on the server, but not on ...
Chaosed0's user avatar
  • 773
1 vote

How do I use Unity's TargetRPC calls? Trying to send data from the server to a client

Based on this code i'm assuming that you want the data to be sent from player to player? ...
Nolic0321's user avatar
1 vote

Creating a master server for Unity game (Unity 2017)

Reality check.The Unity CCU deal is fine for novice developers. Assuming your game will be the next blockbuster game is going to be disappointing. Spending 100's/1000s of hours setting up a cutting ...
Jack Spite's user avatar
1 vote

Creating a master server for Unity game (Unity 2017)

You can have as many users as you would like and scale as you grow using unity multi player services as seen here UnityMultiplayer Unity offers a free amount of Concurrent users (CCU) for each ...
Justin Markwell's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible