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 biggsthecat · Aug 12, 2016 at 01:29 PM · networkingmeshplayerphoton

How to modify enemy players meshs with Photon Unity Networking?

Hi, I'm working on streaming live data from a PC to other devices so they can observe but not modify. The PC streams the motion data to the other devices fine. What I need next is to be able to turn on and off meshes on my streaming PC character at the mobile device side without changing the original.

The only thing I want the observer device to be able to do is to change whether the main mesh or secondary mesh is visible.

Any suggestions on how to go about this? So far I thought I could stream the 2 game objects or their transforms in the OnPhotonSerializeView and then make the changes locally but this seems to prevent Unity from being able to run at all. Could I pass a boolean of Mesh.enabled or mesh.visible and make changes with that to the observer? Any and all suggestions would be welcome.

Comment
Add comment · Show 4
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 ChristianSimon · Aug 16, 2016 at 10:32 AM 0
Share

You can enable or disable the $$anonymous$$eshRenderer component of the mesh and send this state across the network, so that a single mesh will or won't be visible. Within your OnPhotonSerializeView(...) function call something like stream.SendNext(GetComponent<$$anonymous$$eshRenderer>().enabled); when you write data to the stream and something like GetComponent<$$anonymous$$eshRenderer>().enabled = (bool) stream.ReceiveNext(); when you read from the stream.

avatar image biggsthecat ChristianSimon · Aug 16, 2016 at 12:52 PM 0
Share

Thanks for replying. I'll give that a go now and post back

avatar image ChristianSimon · Aug 16, 2016 at 01:47 PM 0
Share

I have also read your post on the official forums where - in my opinion - you gave some more details on what you want to achieve. Please correct me if I understood something wrong ;)

First case: PC user wants to activate/deactivate one of the meshes (the renderer) on the clients but not for his own view. This can be achieved with the help of my previous answer, but this time do not use GetComponent<$$anonymous$$eshRenderer>().enabled when writing to the stream since this may stay enabled on the PC, but some other local variables which you can send across the network. When reading from the stream still use GetComponent<$$anonymous$$eshRenderer>().enabled = newValue.

Second case: $$anonymous$$obile user decides if he accepts the view the PC user is trying to give him. Therefore it is best to have additional check variables for them. $$anonymous$$eans that if there is an inco$$anonymous$$g stream (because the PC user changed something) it is first checked if the mobile user wants to accept the view.

Within your OnPhotonSerializeView(...) function this might be somehing like:

 if (stream.isReading)
 {
     if (lockView)
     {
         return;
     }
     else
     {
         // Update meshes according to the input stream
     }
 }

avatar image biggsthecat · Aug 16, 2016 at 05:04 PM 0
Share

I reckon first case is a lot closer yea. Although the PC does the strea$$anonymous$$g I'm trying to have it so that either the PC or any observer can toggle whether the body or muscles are visible independently of the other devices. Any time the button is pressed it will only enable/disable the mesh on the device that hit the button.

The first method with "GetComponent().enabled" seemed to cause issue. I'll try creating a new bool value to save the actual value and apply it after it's been passed.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How do I sync a mesh over network? (Photon) 1 Answer

Player names all displayed as local player photon 2 Answers

Player names all displayed as local player 1 Answer

Photon switches player's camera 2 Answers

Photon Network, how to spawn FPSController from Unity Standard Assets? 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