Author Topic: Client actions effect all instantiated players?  (Read 5095 times)

tstack

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 12
    • View Profile
Client actions effect all instantiated players?
« 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


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Client actions effect all instantiated players?
« Reply #1 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(...);

tstack

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: Client actions effect all instantiated players?
« Reply #2 on: April 27, 2016, 02:16:54 PM »
Ha! Brilliant! Of course it is.

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