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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

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

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

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges