Handling Apple Events in Unity

Has anyone any experience handling Apple Events in Unity.

I have a C program that is to run along with my Unity game. The C program listens to audio input and is to notify the game when any one of 5 phrases is heard. My C program can send Apple Events but I don’t know how to recieve them in a script in my Unity project.

Alternatively if anyone thinks Apple Events aren’t the best way to have my applications communicate I’m open to other suggestions.

Any help would be apreciated.

Eoin

You could write a plugin (in C/C++ code) that gets the events from the other program. Would need Unity Pro for that.

Thanks for that, thats what I’m working on now.

Im now having some trouble sending a message from one C program to another. I’ve been looking at the “Apple Events Programming Guide” on the apple website but the program I’ve written to recieve messages crashes at run time. Bearing in mind that the message I wish to send are very simple, can anyone direct me to some some code for two C programs that can communicate with eachother using Apple events.

Many Thanks,

Eoin

Have you looked on the Apple Developer, i know the apple event sample codes are sparse, maybe they removed all of them. Apple events are always a pain, maybe you can just use the cocoa apple event wrapper instead (NSAppleEvent). You can use cocoa with no problems from a plugin.

Could you just use sockets instead?

I have been using the Apple Developer site for help but there isn’t much example code to help.

Having originally looked at the available methods for interprocess communication I thought using Apple events would be simpliest but on your advice I’ll now look into the cocoa Apple event wrapper or using sockets instead.

Thanks for the help,

Eoin