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 Kyle Cavasos · Apr 28, 2014 at 09:43 PM · networkingrpcnetworkviewnetworkviewid

Network views wrong on re join to server

The clients in my game need to have net ownership of targets to prevent lag on their simulation of physics objects. (So they can be shootable and behave in a realistic manner)

This works. When a player occupies an area, they assume net ownership of the objects in that area. I accomplish that by allocating new network view id's from the players side, then sending all of those view ID's via an RPC call. Groovy.

My problem comes in when a client disconnects. When a client quits via their GUI, they first call an RPC to return net ownership to the server:

On Client:

 if (GUILayout.Button("Yes") )
 {

     Game.m_pInstance.networkView.RPC("ReturnNetOwnershipOfStation", RPCMode.AllBuffered,  m_pOwner.m_pEmbodiedSpawnPoint.m_iIndex);
     StartCoroutine(DelayBeforeQuitting());
     Network.Disconnect(200);
     Application.LoadLevel(0);
 }

On Server:

 [RPC]
     public void ReturnNetOwnershipOfStation(int pSpawnPointIndex)
     {
         if (!Network.isServer)
         {
             return; // Only want server to take action here
         }
 
         Debug.Log("Returning ownership of spawn index " + pSpawnPointIndex + " back to server");
 
         SpawnPoint Station = SpawnPoint.GetSpawnPointByIndex(pSpawnPointIndex);
         
         for (int i = 0; i < Station.m_pOwnedTargets.Count; ++i)
         {
             GameObject subObj = Station.m_pOwnedTargets[i].GetComponentInChildren<NetworkView>().gameObject;
             NetworkViewID newViewID = Network.AllocateViewID();
             
             networkView.RPC("UpdateGameObjectsNetworkViewID", RPCMode.AllBuffered, subObj.networkView.viewID, newViewID);
         }
     }


I get a runtime error saying: Couldn't send RPC function 'UpdateGameObjectsNetworkViewID'

Furthermore, when that same client re joins the server, the server spouts off a magnitude of errors looking like this:

View ID AllocatedID: 300 not found during lookup. Strange behaviour may occur Received state update for view id' AllocatedID: 300' but the NetworkView doesn't exist

Every time the client re joins, the network view ID's that they see increase by about 100. (ie they rejoin again, they get ID's in the 400 range)

What could be causing these ID's to be out of sync, and increment them like this on joining the server again?

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 Kyle Cavasos · May 02, 2014 at 09:25 PM

Update:

I managed to fix this with a sledgehammer approach by saying each client that joins receives the list of all network ID's that the server see's and manually sets them so they sync up

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 pfialho · Mar 10, 2015 at 08:06 PM 0
Share

Could you please post (part of) your solution? I have the same problem, and can't figure how to get a list of all ID's neither how to manually sync.

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

How to sync networkViewIDs 0 Answers

Network Views from separate scenes causing conflicting IDs? 1 Answer

RPC or Synchronization ? 1 Answer

Where is a free, helpful tutorial on how to use Unity's networking? 2 Answers

Is server the sender of RPC? 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