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 PUN.

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.

How to use triggers with PUN?

Laplace
2020-09-03 14:37:52

I've been going at this for 3 days but I can't find any tutorial of how to get triggers working. I'm making a simple game, I've managed to get the players to join a room. I place a trigger and an AI has to go to its position. The AI interacts with the trigger alright but the player cannot interact with it. Both the trigger and AI are running on local machine.

Comments

OdoVR
2020-09-24 00:43:38

Are you talking about handling an OnTrigger() event?

If so, you can run a check to see if the owner of the "other" collider is your local player (photonView.isMine) and handle the event as you need.

For example:

private void OnTriggerEnter(Collider other)
{
PhotonView phView = other.gameObject.GetComponent();

}

Hope this helps. :-)

Back to top