I am trying to make a multiplayer air hockey game in Unity, but encountered some problems. When the first user creates the room, the hockey puck is spawned along with the first player's mallet (the object you hit the puck with). When the second player connects to the Photon server, their mallet is spawned.
The issue is when the second player hits the puck with his mallet, the Rigidbody physics don't work on the puck. The puck slides right along the mallet, but doesn't bounce off the mallet.
I am new to Unity, so I don't know what part of the code to post. But this is the code where I spawn the items:
private void Start() {
Vector2 puckPosition = new Vector2(0,0);
Vector2 randPos = new Vector2(Random.Range(minX, maxX), Random.Range(minY, maxY));
if(CreateAndJoinRooms.intHold == 0) { // If the user created the room, the result is 0
PhotonNetwork.Instantiate(puckPrefab.name, puckPosition, Quaternion.identity);
}
PhotonNetwork.Instantiate(playerPrefab.name, randPos, Quaternion.identity);
}
Mallet Prefab:
Puck Prefab: