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 NWegener · Jul 04, 2012 at 05:45 PM · networknetworkview

NetworkViewID set to 0 at Start

I set up my Prefab with a NetworkView-Component. When I look at the Objects of the Prefab in the Unity-Editor, they all have a NetworkViewId and Type "Scene", however when I start the Game the NetworkViewIDs of all Objects of that Prefab become 0 and the Type changes to 'Allocated'. Naturally no State-Synchronisation or RPCs work. Nothing appears in the Console either.

Does anybody know what is happening here? I would like to be more detailed but I have no idea what is happening here. I have other Prefabs with a NetworkView, but everything is working fine with them. I don't even know if this is a bug or if I am doing something wrong.

Comment
Add comment · Show 6
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 whydoidoit · Jul 04, 2012 at 05:51 PM 0
Share

So you aren't instantiating this prefab - it is just part of the scene?

avatar image NWegener · Jul 04, 2012 at 05:53 PM 0
Share

yes, just part of the scene.

avatar image Bunny83 · Jul 04, 2012 at 05:59 PM 0
Share

Do you have a prefab or a prefab instance? Prefabs are off scene objects which can be instantiated into the scene at runtime. So i guess you have a scene object which has a NetworkView with a Scene-NetworkViewID, right? Do you have actually a problem with the ID?

A NetworkViewID consists of 3 integer values (private members a, b and c). The value you get back by ToString is probably either one of the ints are calculated from them. However you shouldn't bother about the actual value, just take the ID as an ID-object You don't have to care about how it works internally. You can compare ViewIDs and deter$$anonymous$$e it's owner, that should be enough.

avatar image NWegener · Jul 04, 2012 at 06:08 PM 0
Share

@Bunny83: I put Instances of the Prefab into a Scene, and I actually have problems with the NetvorkViewID in the case of RPCs. An Example: I actually have two Objects with that Problem. One has the RPC-Function "pauseGameRPC" and the other does not. Now because both have the ID 0, the "pauseGameRPC"-Call is send to the one without that function.

avatar image NWegener · Jul 04, 2012 at 06:16 PM 1
Share

Okay, found a Solution and posted an answer, thanks for your efforts.

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by NWegener · Jul 04, 2012 at 06:16 PM

Wow, I just found the Solution for the Problem: The Objects that I had that problem with were in the Scene, before I gave the Prefab a NetworkView-Component. So after I deleted the Objects and put new Instances of them in the Scene it worked for the new Instances.

Why that problem happened now and not before (as I had another Prefab where that worked fine), I do not know, but the important thing is I now know what to do if that happens again. Thanks to whydoidoit and bunny83 for trying to help.

Comment
Add comment · Show 3 · 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 coffiarts · Aug 03, 2013 at 01:13 PM 1
Share

I am glad to have found this post/answer!

I've been struggling with similar issues since long (see this discussion as an example). It is a new and very helpful information for me that this problem is related to manipulating a prefab after it has already been added to a scene!

I found out in my case that two things can work around the problem:

  1. Delete and recreate the network views on any scene objects affected.

  2. Even more elegant: Reverting the problematic network views of the scene objects affected to the prefab values (by right-clicking the network view in the inspector, then choosing "Revert to prefab").

At least in my case it helped fine! No more "unassigned 0 view IDs"!

avatar image BlackManta · Nov 24, 2014 at 04:51 AM 0
Share

You rock! I couldn't figure out why when i destroyed a "plant" prefab a different plant would be destroyed. I was about to start all the way over on the networking!.

I noticed saving and re-opening the scene twice, seems to fix it. (Not very scientific but it seemed to do a the trick).

Perhaps it is an editor error?

avatar image JoRouss · Apr 05, 2015 at 12:32 AM 0
Share

Holy crap thank you so much.......

avatar image
0

Answer by nevaran · Oct 26, 2013 at 12:03 PM

The thing is that every object in the scene with the network view component attached to it has a view id of 0, which means the owner is the server. Any other id is the client.

But again, this is from what I experienced with the network and haven't read it from anywhere. Allthou I have recently figured that out, it seems to work for what the problem ive had with my pick up system in the multiplayer game im making.

To set a view id owner, you can see the box spawn example at the docs: http://docs.unity3d.com/Documentation/ScriptReference/Network.AllocateViewID.html

From all ive researched though, view id 0 is always the server, and the others are always the clients(have not tested with negative ids as -1, -2, ect.)

Hope this was useful. Cheers

-Nevaran

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
avatar image
0

Answer by JosephGrainger · Aug 06, 2015 at 03:17 PM

I have found if you have a prefab in multiple scenes, and you apply a new child object which holds a NetworkView to the prefab it will automatically receive the ID of 0 (Using Unity 5.1.2f).

I have found a simple solution to this to be to re-import the project which re-allocates objects with new NetworkView IDs. I have also tried re-importing individual scenes, but on occasion the issue has remained.

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[FIXED] Sync crate position over network 0 Answers

NetworkView Only Synchronizing the Server's Transform 1 Answer

Can I delay the instantiation of the network objects? 1 Answer

How to let the other network player to see a launched rocket and its explosion? 1 Answer

Troubles with using NetworkViews on a server 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