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
1
Question by azix · Mar 15, 2013 at 11:56 AM · rpcnetworkviewowner

Owner on NetworkViewID not consistent when sent over RPC

Hello,

I am trying to instantiate object in all the connected players using RPC instead of Network.Instantiate (because I need to send additional parameters).

The player that initiate the instantiation allocates a NetworkViewID and calls a RPC to all players with this view ID as parameter. A GameObject is instantiated in this RPC and its NetworkView's view ID is overrided with the value received as a parameter. But I have a strange problem : it seems that the owner of this view ID is no longer the player that has allocated it in all the player.

Let's say that I have a server (p0) and two clients (p1 & p2). p1 allocates the view ID and calls the RPC on everybody :

  • Owner on p0 : p1 (OK)

  • Owner on p1 : p1 (OK)

  • Owner on p2 : p0 (ERROR)

This owner inconsistency creates problem when I call RPC from the new NetworkView. Depending from which player I call them, not everybody receive the RPC call.

I have made this little class to illustrate the problem :

 [RequireComponent(typeof(NetworkView))]
 public class TestViewID : MonoBehaviour
 {
     [RPC]
     void Test(NetworkViewID viewID)
     {
         Debug.Log("player: " + Network.player.ToString()
         + " viewID: " + viewID.ToString()
         + " owner: " + viewID.owner.ToString());
     }
     
     void OnGUI ()
     {
         if (GUILayout.Button("Test"))
         {
             networkView.RPC("Test", RPCMode.All, Network.AllocateViewID());
         }
     }
 }

When I click on Test on player 1 I get the previous result but you can see the the ViewID's "id" is the same on all players :

  • player: 0 viewID: AllocatedID: 50 owner: 1

  • player: 1 viewID: AllocatedID: 50 owner: 1

  • player: 2 viewID: AllocatedID: 50 owner: 0

Is it a normal behaviour or a bug ? I am using RPCs and AllocalteViewID correctly ? How can I allocate a view ID on (potentially) a client, and send it over RPC while keeping the same owner ?

I am using Unity 3.5.7 but there is the same behaviour on unity 4.0.

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 azix · Mar 25, 2013 at 01:42 PM

Well, it seems to be a known problem : http://forum.unity3d.com/threads/51312-networkView-owner-issue?highlight=networkview%20owner

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 Fattie · Mar 25, 2013 at 02:17 PM 0
Share

purely FWIW ...

http://answers.unity3d.com/questions/326626/games-with-multiple-maps.html

many people just NEVER USE the "send to all" mode of the RPC call in Unity. Arguably, it's basically 'crazy" and it's best to never use it.

Stick to normal, conventional, 40-years-proven "hub and spoke" networking.

I never use the "crazy" version of the RPC call, because it's, well, crazy :) So I didn't even know the problem you describe.

So just a thought.

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

11 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

Related Questions

Send RPC to owning NetworkPlayer of networkView 1 Answer

Does the position change need state synchronization? 2 Answers

Problem with Playmaker Send Remote Event 1 Answer

RPC with Network View 0 Answers

get return on networkView.RPC 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