uLink: How to Use Remote Procedure Calls

Hi,

I’m using uLink but I can’t seem to grasp how to properly use RPCs

I am getting NullReferenceException: Object reference not set to an instance of an object

On the server I have:

[RPC]
void UpdateServerData(string sendName, string sendQuest, string sendPass)
{
	Debug.Log("received server info");
	serverName = sendName;
	serverQuest = sendQuest;
	serverPass = sendPass;
}

On the client I have:

networkView.RPC("UpdateServerData", uLink.RPCMode.Server, name, quest, pass);

I am trying to send some information about the room a user created to the server so it
can update itself. The information being sent is from input fields.

The same information will be used to generate the interface for the client.

This is the full traceback

NullReferenceException: Object reference not set to an instance of an object
#=q00ZsoX62hhBj3fK02WgoBNiS6IE5Ad$FZagsj2kQ6Ao=.#=qUEWtYJqQEI1KS0Mc1fI4bQ== (.#=qWkEOW2KtY7pDi7ylMFA2tA== #=qsWDZJ4etkUDha830JFbYJg==)
#=q00ZsoX62hhBj3fK02WgoBNiS6IE5Ad$FZagsj2kQ6Ao=.#=qogU$7f0vvAGMpAzFahHsaw== (.#=qWkEOW2KtY7pDi7ylMFA2tA== #=qfz$wP73IK7EgigXfV3_5DA==)
#=qVVbkOVysVhScFCeMDLyh1Ey9YmB2I4kq9d5aOpePRU4=.#=q9_eP3Dvf0L4d97I8TndURw== (.#=qWkEOW2KtY7pDi7ylMFA2tA== #=qnhM2qcutHOjuyme__GYkhQ==)
#=qVVbkOVysVhScFCeMDLyh1Ey9YmB2I4kq9d5aOpePRU4=.#=q3CR_HKHw8vB1_C_6utYLsQ== (.#=qWkEOW2KtY7pDi7ylMFA2tA== #=qG5pCviD3oscxASVSRS4Mhw==, RPCMode #=qNH_4ODupsG1pOgDTfBe9_w==)
uLink.NetworkViewBase.RPC (NetworkFlags flags, System.String rpcName, RPCMode mode, System.Object[] args)
uLink.NetworkView.RPC (NetworkFlags flags, System.String rpcName, RPCMode mode, System.Object[] args)
uLink.NetworkView.RPC (System.String rpcName, RPCMode mode, System.Object[] args)
GameScreen.uZone_OnInstanceStarted (uZone.GameInstance gameInstance) (at Assets/Scripts/Network/GameScreen.cs:494)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
#=qv50bRFciuVFjBO_wvUnn7wJLQc$qllwG0Ydv2jjtbMA=:#=qgMU$IS2GrNj5rYtLr4QOjA==(#=q2ZGynRGHw06fovfvoMpjz_RK8h7QRyDgM0dR1zo57xs=)

Line 494 in GameScreen.cs is the ...RPC("UpdateServerData")... line above.

In this image below you can see that I enter the information, the debug.log displays the information I entered right before it is sent. So they are not null.

Well, i never used uLink and i guess not that much people develop network games and even less use uLink.

I would recommend to read the developers docs first:
http://developer.muchdifferent.com/unitypark/uLink/RPCDetails

Since you use networkView.RPC i guess you have inherited your class from uLink.MonoBehaviour like stated in the docs, right?

Besides that make sure your 3 variables are not null (keep in mind that a string can also be null).

I found the problem. I had uLobby setup and a client connecting to it, I didn’t actually use uLink’s methods so it never recognized it as a server and the uLink.RPCMode.Server failed as a result.

Now to re-write a bunch of code, thanks to the people who tried to help.