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 AndreasX12 · Jan 02, 2014 at 07:42 PM · multiplayerphotonclientcloud

Photon enable/disable objects on all views?

Hi. I have added multiplayer to my game using Photon Cloud (PUN+).

My problem is, that when my script disables/enables an object, that does not happen on the other client's view.

I know this is how Photon handles multiplayer, but what would be the best way of disabling/enabling gameobjects on both views/clients?

Thannks, Andreas.

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

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Jellezilla · Apr 23, 2014 at 10:27 AM

I'm not sure from your description, how far you are in the process, so this may be somewhat unprecise.

In order to call methods etc., for a specific client, you need to check ownership. This can be pretty simple with PUN. The client who instantiates an object, will also be the owner of said object. The check is performed by "photonView.isMine()".

 if(photonView.isMine()) {
    // do something for this specific client 
 }


If however, you already are able to make changes, specific to the clients, then I'm guessing your issue is to make it apply it on the server, so that all other clients can see it. This is typically done by either streaming the data through [serialization][1] or by using [Remote Procedure Calls (RPCs)][2] OBS: I was unable to find the documentation for Photons own RPC methods, but they are very similar to Unity's RPCs. Major difference is how you call it: instead of Network.RPC("method_Name", targets), you have to use PhotonView.RPC("method_Name", targets);

The Marco Polo tutorial found at [exitgames][3], gives a nice overview of how data streaming can be done, especially under the "Adding Animations" paragraph.

Hope this proves useful to you. Good luck :) [1]: http://doc.exitgames.com/en/realtime/current/reference/serialization-in-photon [2]: https://docs.unity3d.com/Documentation/ScriptReference/NetworkView.RPC.html [3]: http://doc.exitgames.com/en/pun/current/tutorials/tutorial-marco-polo

Comment
Add comment · Show 1 · 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 selva2animation · May 22, 2019 at 03:07 AM 0
Share

I am using a variable that will turn off/on a sprite in update and I have serialized in serializeview function for the other players like sendnext and receive next, This works very charm in single/local player, but when a player joins, the sprite not getting disabled in the other playerside. Do we need RPC compulsory for this ???

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

21 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

Related Questions

Photon: Storing map data for persistence - what's the best way do to this? 0 Answers

Cannot see other player in Multipayer Project? 0 Answers

How to add a component to a prefab 1 Answer

set otherplayer as master client when master client leaves room photon 1 Answer

Spawning troubles 2 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