- Home /
Networking sending info only one direction
Hello,
So I tried messing around a bit with Unity's Unet networking system to move players around.
The problem I have is that only one player (the client) is shown moving both on the client screen and on the host screen. When I move the host he is only shown moving on his screen.
I figured that since I only send one point to move then I don't need the players to sync all the time so the Network Transform send rate is set to 0.
How do I fix it?
Thanks in advance to all helpers :)
My code is very simple click to move:
public Sprite localSprite;
public Vector2 pointToGo = Vector2.zero;
public float speed = 5;
public float distanceDeadZone = 0.1f;
void Update ()
{
if(pointToGo != null)
if (Vector2.Distance(pointToGo, transform.position) > distanceDeadZone)
transform.position = Vector2.MoveTowards(transform.position, pointToGo, speed * Time.deltaTime);
if (!isLocalPlayer)
return;
if (Input.GetMouseButtonDown(0))
raycastGround();
}
private void raycastGround()
{
RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
if(hit.transform != null)
{
pointToGo = hit.point;
}
}
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Multiplayer problem 1 Answer
Requesting data from server 1 Answer
Why will the raycast not work on the client? 2 Answers
Would it be possible for every person to host the server.... And yet no one. 1 Answer