I'm developing my first simple game, a racing car, using Unity and Photon. In my game there are a function that generate random Bonus on random position each (for instance) 5 seconds.
The problem is that if I use RPC, each Peer connected generate a bonus each 5 seconds and send that bonus on other client connected . Results: if i have 5 clients, each clients generate 1 bonus each 5 seconds resulting in 25 bonus each 5 seconds.
So, i would like that ONLY the server generate bonus and send this bonus to each clients.
In short: i don't know how to 'tell' unity and photon "If i am the server run this function, otherwise not"
if (i am server ) generate bonus instantieBonus on clients }