Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 KuPAfoo · Dec 01, 2013 at 09:25 PM · photonrenderer.enabled

renderer.enable = photon?

0n my objects I have included a script to enable/disable 2 points of weapons (sheathed and wielded)

in the game, over the network when I press the corresponding button to enable/disable the mesh' all players online follow the same protocol, and is not seen by other clients.

Rather than using a separate script on each object to renderer.enable should I be sending the object.renderer.enable through photon?

I'm a bit stumped by photon, and the internet is cluttered with threads that used to exist and don't now

alt text

Edit: After testing the suggestion below, I've dug up some information alt text

The bottom of the window includes the error i'm receiving. I've looked this up, and it tells me I need to reference an object just like the error. I've tried instantiating the object i'm scripting on in multiple different fashions.

Still stuck

12-1-pun.jpg (77.3 kB)
12-2pun.jpg (170.7 kB)
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 AlucardJay · Dec 02, 2013 at 05:15 AM 0
Share

Use an RPC call.

pseudocode :

 if ( Input )
 {
     photonView.RPC( "SetRenderer", PhotonTargets.All );
 }
 
 @RPC
 function SetRenderer()
 {
     // change the renderer
 }
avatar image KuPAfoo · Dec 02, 2013 at 06:07 AM 0
Share

Sweet, thanks! That helps... Now where should that work? Network view? Photon script? hierarchy-specific objects? third person controller?

avatar image KuPAfoo · Dec 03, 2013 at 01:10 AM 0
Share

I've added photonview to the object I'm scripting on, aswell as set observation to none.

avatar image KuPAfoo · Dec 03, 2013 at 11:21 PM 0
Share
 using UnityEngine;
 using System.Collections;
 
 public class sheildWeild : $$anonymous$$onoBehaviour {
     bool weild;
     
     public static string setRenderer = "SetRenderer";
     // Use this for initialization
     void Start () {
         //sheildWeild SHEILD = new sheildWeild();
         //sheildWeild sheild = sheildWeild.Instantiate(sheildWeild);
         //sheildWeild SHEILD = this.gameObject;
         PhotonNetwork.AllocateViewID();
     weild=true;
     }
     
     // Update is called once per frame
     public void Update () {
         if(Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.BackQuote))
         {
         PhotonView.RPC("SetRenderer", RPC$$anonymous$$ode.AllBuffered, weild, transform);
         //PhotonView.RPC("SetRenderer", PhotonPlayer.AllBuffered, null);
             
         }
     }
     
     [RPC]
     public static void SetRenderer(bool weild, Transform QRN){
     if(weild==false)
             {
             QRN.renderer.enabled=true;
             //renderer.enabled=true;
                 weild = true;
             }
         else
             {
             QRN.renderer.enabled=false;
                 weild = false;
             }    
     }
     
 }

error CS0120: An object reference is required to access non-static member 'PhotonView.RPC(string, PhotonPlayer, params object[])"

I've searched the CS0120 and it only explains passing a string's content through the parameter of params object[]. Here, i'm attempting to RPC the rendered state of the object. I'm about to start texturing models because I cannot seem to figure this out, and I have played around as you can tell from my script's comments

avatar image KuPAfoo · Dec 04, 2013 at 05:43 AM 0
Share

I got RPC working properly, but it sends in an odd fashion. All shields/swords are affected on all clients, or my shield affected on other's client, and other's shield affected on my screen (all from my keypress)

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

17 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Accessing a Parent's PhotonID from a child's script 0 Answers

Enabling component - Please help 1 Answer

Photon Unity Networking:How do i set it to only let players control themselves? 0 Answers

"NullReferenceException: Object reference not set to an instance of an object" 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