Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 arain55 · Aug 12, 2014 at 03:08 PM · multiplayerfpsphotonsync

please help multiplayer question(photon).

help .. i made an assault shield and i put photonview on it but when i start my game twice on the second screen the shield doesnt show up on the chracter but from the chracter itself i van see it.

 my variables:
   
 var uses int = 1;
    var shield : GameObject;
     .................................
 
     if(Input.GetKey(KeyCode.V)&&uses=1){
     
        shield.SetActive(true);
        WaitForSeconds(10){
          
          shield.SetActive(false);
        }
      
     }
 
Comment
Add comment · Show 3
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 StianC · Aug 12, 2014 at 05:04 PM 0
Share

do you have a code snippet?

avatar image arain55 · Aug 13, 2014 at 04:50 PM 0
Share

yh ill put it in

avatar image kikoncuo · Jan 03, 2015 at 12:21 PM 0
Share

Build the game run it, then in the editor, dont move any of the players and activate the shield in the built version.

Now look for the shield in the editor:

is it somewhere wrong? This is usually a problem while parenting the gameobjects

does it follow the player? You may have not set the transform of the shield in the photon view component, or you are instantiating the shield at runtime (Ill explain further if this is the case)

doesn't exists at all? this is more complex a video showing doing what I explained, the shield component in the editor etc may help

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Tumtable · Jan 03, 2015 at 01:36 PM

I guess that's because the SetActive() method only works at the local game. If you want to activate or deactivate the shield using SetActive(), you will need to call a RPC function on all the clients to activate your shield on their games too. Like that:

 var uses int = 1;
 var shield : GameObject;
 .................................
  
 if(Input.GetKey(KeyCode.V)&&uses=1){
    networkView.RPC("activateShield", RPCMode.AllBuffered, true);
 
    WaitForSeconds(10){
       networkView.RPC("activateShield", RPCMode.AllBuffered, false);
    }
 }
 
 @RPC
 function activateShield(active:bool) {
    shield.SetActive(active);
 }

Of course that's a lot of ways to do that, you can also call a RPC method that controls the shield on the other clients game. =]

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

[PHOTON PUN] Players cant shoot each other? 1 Answer

Do Photon networked scene objects have to be instantiated? 1 Answer

Is that any way to pass list of array through photon? 0 Answers

Problem with UFPS and photon 1 Answer

Photon Networking Instantiating Problem 0 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