Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Aug 12, 2019 at 07:59 PM by CriticalAngleStudios for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by CriticalAngleStudios · Aug 10, 2019 at 05:23 AM · networkingmultiplayerfpsphotonpun

[PHOTON PUN] Players cant shoot each other?

Hey guys! So, I've been working with PUN for a while now, but whatever I do, I can't seem to get shooting to work. The problem is (by the title) that players can't shoot each other, and I have no idea why! But all I DO know is this: When a player shoots, they do detect shooting other players. When the player shoots another player, it get's a script on the other player and calls a function that deals damage to that player. Well, I use getComponent to get that script, but when I shoot, the GetComponent doesn't go through! In other words, for some reason I can't access the script! Here's my code to do the damage on the local player: https://paste.myst.rs/70m And my code to take damage on the other players: https://paste.myst.rs/vvw Any help would MUCH appreciated. Thanks!

Comment
Add comment
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

1 Reply

  • Sort: 
avatar image
0

Answer by Captain_Pineapple · Aug 10, 2019 at 10:26 AM

Hey there,

Please add debug.Logs in your shooting logic to see which object you actually hit. I guess you just have to replace all objectHit by objectHit.transform.root to make sure that whereever you hit the other player you will always access the same transform on them.

If this does not help please report back and post some more info about what you hit, how your hierarchy setup is with colliders and please make really really sure the raycast does not get stuck in your own player...

Comment
Add comment · Show 8 · Share
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 CriticalAngleStudios · Aug 11, 2019 at 12:29 AM 0
Share

I did debug it and the players are hitting each other, but the method calling doesn’t always go through

avatar image Captain_Pineapple CriticalAngleStudios · Aug 11, 2019 at 07:30 AM 0
Share

Did you add else statements to all your ifs with a debug.log inside? then you can see which of the statements actually blocks you?

avatar image CriticalAngleStudios · Aug 11, 2019 at 01:13 PM 0
Share

Hey man, I’m sorry, but I don’t think you understand. It’s the RPC that’s not going through, and that’s what I want to solve

avatar image Captain_Pineapple CriticalAngleStudios · Aug 11, 2019 at 08:48 PM 0
Share

well yes indeed, you should have mentioned a problem with rpcs...


that little tag at the start of your code snippet is easily missed.

So does the rpc not trigger for other players or does this whole function just not work as intended at other players instances?

avatar image CriticalAngleStudios · Aug 12, 2019 at 01:51 AM 0
Share

The rpc doesn’t trigger on the other player yeah @Captain_Pineapple

avatar image Captain_Pineapple CriticalAngleStudios · Aug 12, 2019 at 06:50 AM 0
Share

If it's never even called at all then you should include the code where the rpc is sent.

avatar image CriticalAngleStudios · Aug 12, 2019 at 04:35 PM 0
Share

No! Dude! The RPC is being called, but just not on the other players! I said that in my previous comment. And besides, the code where I call it is just a simple photonView.RPC(“Shoot”, RpcTarget.AllBuffered);

avatar image CriticalAngleStudios · Aug 12, 2019 at 05:13 PM 0
Share

Do you have discord or something? Wanna chat there?

Follow this Question

Answers Answers and Comments

245 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Photon pun problem on send and read request 0 Answers

OnConnectedToMaster() vs IsConnectedAndReady? 1 Answer

Photon Networking Instantiating Problem 0 Answers

Callback for DNS entry error using Photon Networking 0 Answers

Unity networking tutorial? 6 Answers


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