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 /
  • Help Room /
This question was closed May 11, 2017 at 07:14 AM by SohailBukhari for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by SohailBukhari · May 04, 2017 at 10:03 AM · networkingphotonduplicate

duplication of network gameObjects of Photon on Client.

Is it necessary to clean up network gameObjects manually by calling PhotonNetwork.DestroyAll(); or cleanup by calling LeaveRoom() or Disconnect. Because when i joined room as a client after leaving room or disconnecting again join or connect as a client i get duplicated networks gameObjects.

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

  • Sort: 
avatar image
0
Best Answer

Answer by ChristianSimon · May 04, 2017 at 10:24 AM

Hi,

cleaning up manually is usually not necessary, since this will be handled by the server. You can find more information about this in the section Lifetime of Networked Objects in the Instantiation documentation.

If you have duplicated game objects, you maybe have set PlayerTtl and EmptyRoomTtl to another value than 0 when creating the room. PlayerTtl describes the time the data of a disconnected client will be held in the server's memory before removing him. This allows to let this client rejoin the game. EmptyRoomTtl describes the time an empty room will be held in the server's memory before removing its data.

Comment
Add comment · Show 4 · 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 SohailBukhari · May 04, 2017 at 11:42 AM 0
Share

i am creating room using this code

   private void CreateRoom(string roomName, string playerName)
    {
        if (playerName.Length <= 0 || roomName.Length <= 0)
        {
            return;
        }
        RoomOptions roomOptions = new RoomOptions {maxPlayers = (byte) $$anonymous$$axPlayersPerRoom, isVisible = true };
        PhotonNetwork.player.name = playerName;
        PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
    }

i didn't use PlayerTtl and EmptyRoomTtl anywhere in the code.

avatar image ChristianSimon SohailBukhari · May 04, 2017 at 12:50 PM 0
Share

Do you set PhotonNetwork.autoCleanUpPlayerObjects to false somewhere in your code?

avatar image SohailBukhari ChristianSimon · May 04, 2017 at 01:54 PM 0
Share

i set PhotonNetwork.autoCleanUpPlayerObjects to true in the Start().

avatar image SohailBukhari SohailBukhari · May 05, 2017 at 12:18 PM 0
Share

you are right that cleaning up manually is usually not necessary, since this will be handled by the server. the problem was with my code and now working fine. Thanks for the help!

Follow this Question

Answers Answers and Comments

129 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 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

Can't see other players on the server 1 Answer

Photon synchronization on different devices failes 0 Answers

Photon Networking - How to move all players from game scene to current room scene? 0 Answers

How to choose different teams one by one 1 Answer

Photon Voice chat and Speech to text plugin not working together 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