I have two script a js and a C#
I want to send a var from js to C# with this:

LanMenu.SendMessage("GetPlayerName", PlayerName, SendMessageOptions.DontRequireReceiver);

and the C# has a void:

void GetPlayerName(string InMenuName)
	{
		PlayerName = InMenuName;
	}

but nothing happend. :frowning: why?

After a lot of comments and research, I found this thread. Dreamora’s answer explains the issue you have.

In my test environment, placing MenuOfLan script in Assets\Plugins folder worked. There might be another problem though, if you need to access other scripts from MenuOfLan.

Maybe a good solution would be to switch to one language only, as other people suggest. Of course if you don’t have tough to convert external code.

SendMessage(methodName: string, value: object, options: SendMessageOptions)

The above is the declaration or signature of sendmessage method.

Even if you are using both scripts on same game object it should work.

Make sure that “PlayerName” is of type string.

Also make sure the scripts in which is you are sending and receiving message are enabled are not.

One more