How can I send/receive a custom object via SendMessage?

Hi! I’m trying to send multiple parameters with SendMessage and packed them like this:

import UnityEngine
class CommandHandler (MonoBehaviour): 	
   	class InteractionInformation:
   		public isInContact as bool					
   		public playerAnimation as string			
   	interactionInfo as InteractionInformation

Now how can another script receive this interactionInfo object? I got trouble specifying its type:

def MessageFromCommandHandler( info as InteractionInformation ):	
	globalVar = info

Unity does not know such class - InteractionInformation and everything else I tried (Object/MonoBehaviour/ScriptableObject/GameObject) sends “isInContact is not a member of ‘object’”.

It is not a good practice to define two classes in one script. Make a separate one, or what is better define SendMessage options inside the class which should receive them and refer to it as ‘ClassName.MessageOptions’.

Something like this:

using UnityEngine;
using System.Collections;

public class Receiver : MonoBehaviour {
	public class MethodOptions
		//some data
		int i = 0;
		int j = 0;
		int k = 0;
		public MethodOptions()
		public MethodOptions(int i, int j, int k)
			this.i = i;
			this.j = j;
			this.k = k;
	public void Method(MethodOptions options)
		Debug.Log("I: " + options.i.ToString() + "J: " + options.j.ToString() + "K: " + options.k.ToString());

Then when you need to send something to the Reciever’s instance, do like this:

receiver.SendMessage("Method", Receiver.MethodOptions(1, 1, 1));

Boo delegate works! I’m still in a kind of crossroads but this is one working solution.