Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
maltoc

Network ViewID same

Question

Hello,i'm here because i have a problem with my script .

when the player create a server it's good but when someone connect to the player there control the same prefab , the prefab have a network view component and is connected to a script C# i have fund for the interpolation this is the code :

Please login or register to see this code.

so this script is in the prefab player . i use a function start when the player load the level this is the script : 

Please login or register to see this code.

and in the menu i use this function : 

Please login or register to see this code.

so i don't no where is my error and what i need to do .

 

ps : this is the error : view ID allocated Id not found during lookup.Strange behaviour may occur Received state update for view ID but the networkview doesn't exist

Thanks you to read this and i'm sorry for the error in english i'm french and i don't speak very good english . 

Cordially maltoc

Edited by maltoc

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0

On this networkrigidbody do

PlayerControl script;

void Start())

{

script = GetComponent<PlayerControl>();

if(photon.viewid.ismine) //dont remember how this was

script.enable = true;

else

script.enable = false

}

Something like that should work

Share this post


Link to post
Share on other sites

  • 0
Please login or register to see this quote. i suppose logic will stay almost same in code so just try replace that photon line with the unity one

Share this post


Link to post
Share on other sites
  • 0

So i try but the problem is the networkrigidbody is my only script in C# the other is in javascript so when i change the playercontrol by the script of the control of my player they don't found the script .

i need to do myself the networkrigidbody in javascript to work or i need to change all in C# ? or is something else ?

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

Since you cant seem to get network logic down. Work on single player first save your self some problems

Share this post


Link to post
Share on other sites
  • 0

Yes maybe but in single player i can do everything i want to do so this is why i try to do multiplayer but maybe i can retry all the network and not copy something i don't no but i thinks i be block in the same script so i search what i need to do ?

if i change the networkrigidbody in javascript and add the script of nub it's that can be done ?

 

or maybe i can use photon because there are a lot of tutorial ? like this youtube video : Please login or register to see this link.  i just change the party of FPS in the party of third person control a airplane and it's good no ?

Edited by maltoc

Share this post


Link to post
Share on other sites
  • 0

When you controll all Player instances inside the game is because you haven't set the Player prefab settings properly.

 

What you have to do:

 

1. Disable all the Components/MonoBehaviours of the Player prefab, even children GameObjects. (Except the NetworkView).

2. Make it so that when you instantiate a new Player that he has a MonoBehaviour/Script that checks if the networkView.viewID is his or not.

3. If the networkView.viewID is from that GameObject then enable all the Components/MonoBehaviours in that Player.

 

What this does is that a Player can only "controll" his Prefab inside the Scene, as the other Player prefabs representing the other Players have their Components/Monobehaviours disabled, making it not possible for one Player to controll others inside the Scene.

 

Cheers.

Share this post


Link to post
Share on other sites
  • 0

i have do that in my player control :

Please login or register to see this code.

i need to change that at true and in the function start of my network master i add a system who check the id of the network view or i do that in the playercontrol ? with the script at top ?

if you can explain to me properly you can add me on skype ? tell me in private message and i take 10 min of your time to explain to me all my mistake .

 

 

edit : i try to start from the beginning i have a new error : 

View ID SceneID: 1 Level Prefix: 0 not found during lookup. Strange behaviour may occur
Received state update for view id' SceneID: 1 Level Prefix: 0' but the NetworkView doesn't exist
ms_IDToPointer->find (obj->GetInstanceID ()) == ms_IDToPointer->end ()
Edited by maltoc

Share this post


Link to post
Share on other sites
  • 0

Lets assume a simple Server for simplicity's sake.

 

In this Server when a Player connects to the Server he is Spawned. (I would recommend using Network.Instantiate() for Prefabs with more than 1 NetworkView).

 

Before hand disable everything inside that Player, this means Child GameObjects, and all Components inside the Player GameObject itself. (Except the script you will need bellow and the NetworkView).

 

In that Player you will have a Script with the code bellow, note that this script must not be disabled.

 

Example of a NetworkUser script (Placed on the Player).

Please login or register to see this code.

I hope I better clarified how it works. Cheers.

Edited by danielvd

Share this post


Link to post
Share on other sites
  • 0

Ok so i do a script name NetworkUser placed on the player  :

Please login or register to see this code.

and in my playercontroller they still 

Please login or register to see this code.

so when i launch the server and i spawn all work but the 3Dmodel don't appears . 

and i have this error : View ID AllocatedID: 1 not found during lookup. Strange behaviour may occur 

Edited by maltoc

Share this post


Link to post
Share on other sites
  • 0

1. You're probably forgetting to re-activate the child GameObjects in the Player GameObject after you check if the networkView.viewID is his.

2. View ID AllocatedID: 1 not found during lookup. Strange behaviour may occur. This could mean 2 things:

 

a ) You changed the NetworkView's ViewID while it was being used.

b ) You have 2 or more GameObjects in the Scene with the same ViewID.

 

Make sure you're not setting the ViewID more than once. Note: When you instantiate a GameObject using Network.Instatiate() it automatically allocates a ViewID for all the NetworkView's on that GameObject and its children.

 

Cheers

Edited by danielvd

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...