- Home /
Question by
Stand Alone OS · Jan 05, 2015 at 02:20 AM ·
networkingnetworkrpc
View ID AllocatedID: 50 not found during lookup.
When I have sever running and a player is connected and another connects I get these 2 errors:
Could't invoke RPC function 'UpdateMovement' because the networkView 'AllocatedID: 50' doesn't exist
View ID AllocatedID: 50 not found during lookup. Strange behaviour may occur
Im new to this so could anyone give me a hand? Here is the Movement update scipt which calls the UpdateMovement function. Also this script is attacted to my player with a network view component with stat sync off and no observed component.
using UnityEngine;
using System.Collections;
public class MovementUpdate : MonoBehaviour
{
private Vector3 lastPosition;
private Quaternion lastRotation;
private Transform myTransform;
void Awake ()
{
if(networkView.isMine == true)
{
myTransform = transform;
networkView.RPC("UpdateMovement", RPCMode.OthersBuffered, myTransform.position, myTransform.rotation);
}else{enabled = false;}
}
void Update ()
{
if(Vector3.Distance(myTransform.position, lastPosition) >= 0.1)//If player moves
{
//Update position across the network
lastPosition = myTransform.position;
networkView.RPC("UpdateMovement", RPCMode.OthersBuffered, myTransform.position, myTransform.rotation);
}
if(Quaternion.Angle(myTransform.rotation, lastRotation) >= 1)//If player rotates
{
//Update rotation across the network
lastPosition = myTransform.position;
networkView.RPC("UpdateMovement", RPCMode.OthersBuffered, myTransform.position, myTransform.rotation);
}
}
[RPC]
void UpdateMovement(Vector3 newPosition, Quaternion newRotation)
{
transform.position = newPosition;
transform.rotation = newRotation;
}
}
Comment