The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Syncing shooting

Jaynesh
2021-12-24 09:18:09

Sorry for the stupid question but I have a bullet that is fired every 0.25 seconds. How would this be synced in Fusion?

Comments

Klover
2021-12-24 19:54:30

Tbh I don't really know what's going on here but I think you're trying to do an RPC function. You want to sync this across all clients im assuming. Let me know if I'm totally off here or it helped...

[PunRPC] //Make sure you add this to identify it as an RPC function

void FireWeapon()

{

//Fire gun or whatever your function is

}

//We'll use this function to execute the RPC function for all clients

public void Fire()

{

//Here we're calling the RPC function we just defined above.

GetComponent().RPC("FireWeapon", RpcTarget.All);

}

Jaynesh
2021-12-25 12:06:13

Hi,

Thanks for your reply.

This would work in PUN however I'm trying to do this in Fusion where I'd need the weapon to fire every X ticks on the same tick for every player. Hope that makes sense.

ramonmelo
2022-01-07 11:50:36

Hi @Jaynesh ,

Take a look at the TickTimer class included on Photon Fusion.

You can read more about it using our search bar: https://doc.photonengine.com/en-us/search?p=fusion&v=current&addsearch=ticktimer

This is a tick accurate timer that you can use during the simulation to calculate timed delays, so you can just check if the cooldown is over and fire again, for example.

--

Ramon Melo

Photon Fusion Team

Back to top