Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JohannnesNatterer · Jul 24, 2015 at 03:35 PM · physicsoptimizationrpcsynchronizationnetwork.instantiate

Bullet synchronization via Photon Network doesnt work.

Hey, Im new to Unity and Photon Network. Im trying to make a skillshot shooter with bouncing bullets. The problem is the synchronization between the clients. First I tried no Network Instantiate every bullet and synchronize the positions with the Photon View Component. This was very inaccurate. The next thing I tried was instantiating the bullets via RPC calls on every client. This works until a player touches the bullet . The player is Network Instantiated, therefore his position is lerped and not 100% the same on the clients, leading to unsynchronized bullet . What do I miss? Whats the best way to approach this problem?

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rocket350 · Jul 24, 2015 at 04:02 PM 0
Share

What I always do is instantiate bullets via RPC and then check for a hit on the client machine which shot the bullet. That way, if he hit the player on his machine, he get's the point. It is vulnerable to hacking, but it's more fair for a shooting player.

avatar image JohannnesNatterer rocket350 · Jul 25, 2015 at 12:55 PM 0
Share

the problem is, the bullets continues flying after the hit.

avatar image rocket350 rocket350 · Jul 27, 2015 at 05:37 PM 0
Share

If your Bullet hits a player call the function PlayerHit() with the hit player as parameter:

     void PlayerHit(GameObject hitPlayer){
         PhotonNetwork.RPC(photonView, "$$anonymous$$illPlayerAndBullet", PhotonTargets.All, hitPlayer.name);
     }
     [RPC]
     void $$anonymous$$illPlayerAndBullet (string PlayerName){
         Destroy (GameObject.Find (PlayerName));
         Destroy (gameObject);
     }

Place this function into a script which inherits from Photon.$$anonymous$$onoBehaviour and place that script onto the Bullet prefab.

avatar image JohannnesNatterer rocket350 · Jul 29, 2015 at 02:02 PM 0
Share

It seems like you dont understand the problem. The bullet is meant to continue flying. But when it hits a player its stops being synchron.

Show more comments

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

May different clients on the network load different scenes? 1 Answer

Authoritative Server: Run physics step manually? 1 Answer

Did not find target warning when using uNet 3 Answers

Countdown little help...! 1 Answer

Unity deep profiling is drunk, I think 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges