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
1
Question by DevSkeletal · Dec 02, 2015 at 10:05 AM · instantiatephotondisconnectleavesowner

Unity Photon, have player instantiated objects stay when player leaves

need some advice, working in unity using photon for a multiplayer, for those accustomed with photon there is a variable in the PhotonNetwork script which cleans up player network instantiated or created objects when the player leaves the room, which you can turn on or off by setting m_autoCleanUpPlayerObjects to true or false

the problem is the player can instantiate blocks which other players walk on and i want those to stay in game if the player leaves the game, so i thought setting autocleanup to false would fix this, but then the player and his camera stays in the game and messes everything up for the other players, thought about trying to delete it by setting it to destroy itself if the detected player id leaving the scene is identical but due the ownership is instantly transfered to the next player preventing it from deleting

Also i realise there is PhotonNetwork.InstantiateSceneObject whoch will instantiate objects to a scene, however only the master host can instantiate objects this way and all other players will not be able to

thoughts on how to fix? is there any way to stop the player objects from changing ownership, or maybe make the blocks you place change ownership to the next player to stop them deleting with autocleanup

Comment
Add comment · Show 1
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 Akhil-Raja · Dec 03, 2015 at 07:27 AM 0
Share

How about just turning off the Camera and the player when he leaves ?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Akhil-Raja · Dec 03, 2015 at 11:58 AM

Instead of having player instantiated objects, you can have a function ( marked RPC) which instantiates the required gameobjects and then have a broadcast to everyone on the network. This will give you better control over those objects.

  void instantiateFunction()
     {
         Instantiate(Prefab,gameobject.position,gameobject.rotation);
     }
    
     [RPC]
     void Fire(PhotonMessageInfo info)
     {
         instantiateFunction(); 
     }
    
     void callRPC(PhotonTargets target)
     {
         photonView.RPC("Fire",target);
     }
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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

PhotonNetwork.InstantiateSceneObject works in editor but not in build 2 Answers

tracking ownership of shots 1 Answer

Photon Instantiate Prefab Script Problems 0 Answers

Photon Instantiate Group's, Instantiating Prefabs that should already Exist 1 Answer

Multiplayer game, object instantiated is being added for every single player 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