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 cooltrophygameing · May 08, 2019 at 03:19 AM · photon

photon transform view not syncing???

So im making a flood escape game where one player presses a button and an object disappears. Everything is working but whenever one player clicks the button, it only opens up for that player and for the rest of the players it just shows closed. I put a photon transform view and attached it to the photon view but its still not working???![alt text][1]

screenshot-74.png (331.1 kB)
screenshot-74.png (69.4 kB)
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 Captain_Pineapple · May 08, 2019 at 07:30 AM

Hey there,

a transform view will not synchronize the current active state of an object. So in case you deactivated the object this will not work. What should work is to move the object somewhere offscreen. Since the transform view updates scale translation and rotation it should move for all players.

Be careful here: If this "door" is an object that you got multiple times in your game then updating all 3 values in the network will make you reach your max message limit quite fast.

A better solution would be to give your Bob script an rpc. This rpc will have no other job than to disable your gameobject. This will save a huge huge huge amount of traffic and will actually be able to disable and not only "store away" your door.

If you need help with that let me know. Otherwise share some code how you currently solve this so that we might check for code issues.

Comment
Add comment · Show 3 · 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 cooltrophygameing · May 08, 2019 at 11:00 PM 0
Share

Thanks again for helping me but I have a problem. Its not working. When I tried changing the position all it did was just go right back. Then I tried using sending the position of the object but it didn't work. If you want to check the send code here it is.`using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; public class c : $$anonymous$$onoBehaviour, IPunObservable { private Transform thiss; // Use this for initialization void Start () {

 }
 
 // Update is called once per frame
 void Update () {
     thiss = gameObject.transform;
 }

 public void OnPhotonSerializeView(PhotonStream stream, Photon$$anonymous$$essageInfo info)
 {
     if (stream.IsWriting)
     {
         stream.SendNext(thiss);
     }
     if (stream.IsReading)
     {
        thiss = (Transform)stream.ReceiveNext();
     }
 }

}`

avatar image Captain_Pineapple cooltrophygameing · May 09, 2019 at 08:53 AM 0
Share

Hey there,

obviously yes, this is what it will do. To keep the position that you set for this object you have to set it at the instance of your program where it was created. (So where the is$$anonymous$$ine flag of the photonView is set to true). If player A created the object then player B can set a new position all he wants but it will always go back to the position that you transfer every 0.1 seconds from player A.

For this reason: Do not use the stream!! This will just spam so much information over the network but you don't need this at all.

Create an RPC to solve your problem. Remove the transform view, keep the photonview. Remove the stream code setting the position.

Create a function like this:

     [PunRPC]
     public void triggerDoor(bool value)
     {
         gameObject.enabled = value;
     }

So when you collide/trigger/click/whatever your door you first check if the playerobject who triggers this has is$$anonymous$$ine==true and if yes call this code in your BOB script:

 photonView.RPC("triggerDoor", PhotonTargets.All, false);

This will call the $$anonymous$$ethod triggerDoor on all instances of the game connected to the room. Also it will only be done once. (Saves network traffic)

In case that players are able to join your room later on, consider setting PhotonTargets.All to PhotonTargets.AllBuffered. This way a later joining Player will get the message and will also have the same door status set.

Let me know if something is not clear.

avatar image cooltrophygameing · May 11, 2019 at 01:57 AM 0
Share

Thanks it worked. But I just got to find out how to link the button to the door and stuff.

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

108 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 avatar image avatar image

Related Questions

,How do I transfer photon network ownership to another player? 1 Answer

Photon / Multiplayer 2 Answers

Bullet on network 1 Answer

What are the major differences between Photon Socket Servers and Basic Unity Networking? 2 Answers

photonView.isMine null reference exception 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