Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: tstack on April 27, 2016, 08:34:20 AM

Title: Client actions effect all instantiated players?
Post by: tstack on April 27, 2016, 08:34:20 AM

I think I know the answer here - I have individual TNO IDs for each player, and my few, slow moving projectiles also have TNOs.

I am playing on two iOS devices. When I join the game as the second player, If I hit "fire" both players (myself and the other client) fire their weapons.

Is this because I am using public vars and classes and not protected?

Thanks

Title: Re: Client actions effect all instantiated players?
Post by: ArenMook on April 27, 2016, 12:39:29 PM
No, it's because your fire logic doesn't check to see if it's actually your player before firing the RFC.
  1. if (Input.GetButtonDown("Fire") tno.Send(...);
...should be:
  1. if (tno.isMine && Input.GetButtonDown("Fire") tno.Send(...);
Title: Re: Client actions effect all instantiated players?
Post by: tstack on April 27, 2016, 02:16:54 PM
Ha! Brilliant! Of course it is.

Thanks that totally fixed it.  :) :D ;D