Trying to get a first person controller working...

Ok so I am trying to sorta “remake” the 3rd person example, only for first person, and I have gotten it so everything works for the server (server can see clients move and what not…) however the client can’t see anything. These are the errors I wind up getting for the client.
View ID AllocatedID: 1 not found during lookup. Strange behaviour may occur
Received state update for view id’ AllocatedID: 1’ but the NetworkView doesn’t exist

I just use Network.Instantiate() to make the players, then in the player object I have this code

function OnNetworkInstantiate (msg : NetworkMessageInfo) {
	if (networkView.isMine) {
		print("MINE");
		Camera.main.SendMessage("CameraInit", transform); // tells main camera to target said object
	}
	
	else { 
		name += "Remote";
		print ("URS");
		transform.GetComponent(FPSWalker).enabled = false;
		transform.GetComponent(MouseLook).enabled = false;
	}
	
}


function OnPlayerDisconnected (player : NetworkPlayer) {
	Network.RemoveRPCs(player, 0);
	Network.DestroyPlayerObjects(player);
}

Then for watching the player move, I have a network view that observes the transform object.

I figured out what is happening - the client doesn’t arrive in time for the server players Network.Instantiate, but I don’t know how to fix it, any suggestions?

Ok guys I got it working thanks to http://forum.unity3d.com/viewtopic.php?t=22665

I am very new to networking in Unity. When I read your code it made sense except for the:

 Camera.main.SendMessage("CameraInit", transform);

What does “CameraInit” do? In the third person example it said “SetTarget” which set the target to the correct player. So what does “CameraInit” do.
Unless you have a differnt script on the main camera then can you show me what it is cause I have tried everything and waisted a day.

CameraInit was my own function, it tells the camera where to be placed, and then disables/enabled various scripts depending on wether or not networkView.isMine

Hey, just figured this out today.

Sendmessage calls a function.
So CameraInit would be a function and transform would be a var passed to the function if i understand. Check out Unity - Scripting API: GameObject.SendMessage

J

Thanks. I will try something like this.