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
3
Question by Flynn · Feb 01, 2013 at 10:46 PM · networkingrpcnetworkviewnetworkviewid

Network Views from separate scenes causing conflicting IDs?

I have two scenes. Scene A, and Scene B.

When the game starts, Scene A is loaded. When the player connects to a server, Scene B is loaded.

Inside Scene A there is a NetworkView with a script containing DoNotDestroyOnLoad(). Inside Scene B there is another NetworkView (with nothing special about it).

The problem is, because both network views are in separate scenes, both of them have the same ID (zero), and consequently when they both eventually end up in the same scene together, they conflict!

Now, you might ask, why not have the NetworkView in Scene B just allocate a new ID at run time? Well, I was actually originally doing this, but I have come to the realization that runtime-allocated NetworkView IDs are one way -- IE, you cannot send RPCs to a NetworkView you do not own if its ID was allocated at run time. So, I started using scene-allocated IDs to allow for two way communication! But unfortunately, this has created the godforsaken ID confliction.

Note that invalidating the NetworkView from Scene A will not work -- I need BOTH networkviews to remain functional, and I need BOTH networkviews to support two-way communication.

Does anyone know a way for me to stop this ID confliction? Is there a way for me to allocate IDs at runtime, but still have them support two-way communication? An answer to either query will be marked as answer to this question!

Comment
Add comment · Show 4
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 iwaldrop · Feb 01, 2013 at 11:10 PM 0
Share

Would this not work?

http://docs.unity3d.com/Documentation/ScriptReference/Network.AllocateViewID.html

If it does, let me know and I'll convert this to an answer.

avatar image Flynn · Feb 01, 2013 at 11:14 PM 0
Share

Allocating a view ID seems to remove the ability for two-way communication :(

avatar image iwaldrop · Feb 01, 2013 at 11:18 PM 0
Share

Hmm...bummer. Could you communicate that new view ID to the distant views through RPC? Honestly I've never attempted to use DoNotDestroyOnLoad with an object containing a NetworkView. That really sucks!

avatar image Flynn · Feb 02, 2013 at 12:04 AM 0
Share

Well the interesting thing is, two NetworkViews on the same client have the same ID causing confliction -- I have found no ways of changing the ID of a NetworkView without Unity implementing its security layer and preventing users who do not own the NetworkView from sending RPC calls

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Feb 02, 2013 at 12:48 AM

That sounds like you need Network.SetLevelPrefix, right?

Comment
Add comment · Show 2 · 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 Flynn · Feb 02, 2013 at 02:20 AM 0
Share

Both NetworkViews need to work for the game to run -- If I understand correctly, won't that cause the NetworkView from Scene A to stop working? If it doesn't, won't both NetworkViews still have the same ID + Prefix? Or am I mistaken about both?

avatar image nventimiglia · Mar 12, 2013 at 09:05 PM 0
Share

Yeah this fixes it. I just checked my level loader and set my LevelPrefix to start at 1;

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

12 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

Related Questions

How to sync networkViewIDs 0 Answers

Network views wrong on re join to server 0 Answers

Overloading RPCs 1 Answer

Networking Error! 0 Answers

OnSerializeNetworkView issus in my 2D game 3 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