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 /
avatar image
0
Question by Nsingh13 · Jun 24, 2016 at 08:08 PM · androidnetworkingmultiplayerphotonrpc

Photon - RPC Does Trigger but Does not Show Over Network :(

Hello! So I have a script that launched an RPC method called onFirePress. I know that calling the method works because I have a Debug.log statement that tells me that. However, underneath the Debug.log statement I am trying to activate a bullet object and play a shooting animation for that player. The bullet is activated and the shooting is played but it does so only on my own client. No other network players can see this happen. Can someone please help me out (I've been working on this for days)? Am I just using RPCs wrong? BTW: I do have a photon view on each GO that I call an RPC method from.

Setting the Bullets and Buttons (Awake Method):

 void Awake()
     {
         Joystick = GameObject.FindGameObjectWithTag ("Joystick");
         MovementJoystick = ((CNJoystick)Joystick.GetComponent (typeof(CNJoystick)));
     
         fireButton = GameObject.Find ("Fire Button").GetComponent<Button> ();
         jumpButton = GameObject.Find ("Jump Button").GetComponent<Button> ();
         drinkButton = GameObject.Find ("Drink Button").GetComponent<Button> ();
 
         //Get both Bullets
         leftBullet = this.gameObject.transform.FindChild("Gus_Skeleton").gameObject.transform.FindChild("Gus_Torso").gameObject.transform.FindChild("BulletLeft").gameObject;
         rightBullet = this.gameObject.transform.FindChild("Gus_Skeleton").gameObject.transform.FindChild("Gus_Torso").gameObject.transform.FindChild("BulletRight").gameObject;
 
     }

Setting PhotonView and Getting Button Calls (Start Method):

         //Get Photon View to use for Buttons
         pv = this.gameObject.GetComponent<PhotonView> ();
 
         if (pv == null) {
             Debug.LogError ("You Have no Photon View Attached in the Player GO to call FlashMuzzle!");
         }
 
         //Button Functions
         fireButton.onClick.AddListener(() => { pv.RPC ("onFirePress", PhotonTargets.All); });
         drinkButton.onClick.AddListener(() => {  pv.RPC ("onDrinkPress", PhotonTargets.All); });
         jumpButton.onClick.AddListener(() => { onJumpPress(); });
 
         //Get Arm Animatior
         armAnim = this.gameObject.transform.FindChild("Arms").gameObject.GetComponent<Animator>();
 
         //Get this instance of the PlayerController Script
         thisPC = this.gameObject.GetComponent<PlayerController> ();

The RPC onFirePress Method:

     [PunRPC]
     public void onFirePress()
     {
         if (Fire.bulletShot == false && Fire.reloading == false) {
 
 
         
 
             if (thisPC.facingLeft == true) {
                 // Shoot Gun Left
                 Debug.Log(this.gameObject.name + " is FACING LEFT");
                 armAnim.SetInteger ("EquipAnim", -1);
 
                 armAnim.Play ("ShootIdleLeft", -1, 0f);
 
                 //Activate Equip1 Gun Bullet
                 rightBullet.SetActive(false);
                 leftBullet.SetActive (true);
             }
 
             if (thisPC.facingLeft == false) {
                 // Shoot Gun Right
                 Debug.Log(this.gameObject.name + " is FACING RIGHT");
                 armAnim.SetInteger ("EquipAnim", 1);
 
                 armAnim.Play ("ShootIdleRight", -1, 0f);
 
                 //Activate Equip2 Gun Bullet
                 rightBullet.SetActive (true);
                 leftBullet.SetActive (false);
             }
 
             Fire.bulletShot = true;
             Fire.flashMuzzle = true;
         }
             
     }

Q: The RPC only shows on my client. How can I fix it to make it show on ALL clients?

Thanks for Reading!

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

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

106 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

Related Questions

Photon - How can I get a list of ALL players in EVERY room? 0 Answers

Best Solution for Multiplayer Shooting 1 Answer

Assemblies not found, Zenfone & Photon Multiplayer. 0 Answers

Unity networking tutorial? 6 Answers

[Photon] Restart scene rpc doesn't work 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