Unity can’t handle external sounds yet - it only reproduces audio files. You should use some DLL to record the sound in any format, and then use the resulting file inside Unity.
EDITED: Oops! You’re going to use it in an iPhone… and DLLs are for PCs! Anyway, you should have some external program doing the record and save job, then use the saved file, at least while Unity doesn’t include some feature to acquire sounds from mic or aux inputs.
EDITED2: Don’t mind, that’s what Unity Answers is for: answer questions about Unity. By the way, UA is different from forums: you should use add new comment to reply to answers, not the Answer box, or else other people will think there’s a lot of answers to the same question (I agree, there should exist some warning about this! But don’t mind, everybody does this same mistake at first).
I’m not a Mac user, so I can’t tell you exactly how to do this stuff, but I suppose it’s similar to the PC. In a PC, I would create a DLL (which is a library of routines written in any language, like C, C#, Pascal etc.) with the functions I would need, store it in the Plugins folder of my project and declare these functions in a C# script, like this:
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class RecordSound : MonoBehaviour {
[DllImport("DllRecord")]
public static extern void RecordToFile(String fileName, double duration);
void Update(){
if (Input.GetMouseButtonDown(0)){
RecordToFile("Sound1.wav", 10f);
}
}
}
In this example my DLL file is called DllRecord.dll, and I have inside it a function called RecordToFile which records sound during duration seconds and save it to the file fileName. As an example, I placed a simple code in Update that records 10 seconds and save it to Sound1.wav when the left mouse button is clicked.
I believe the process is similar in a Mac - but using the Mac DLL equivalent, which I suppose is dylib, a XCode Dynamic Library.
This whole process may be painful, since in the dylib you must use obscure system functions to record sounds and save files. But maybe you have a simpler solution: I read somewhere that the FMOD plugin for Unity can accept input sounds, and that it works for Mac - but I’m not sure if it can be used in the iPhone. As a plugin, the connection with Unity is probably done like the example above - and I believe the plugin files already include the function declarations, which would greatly easy your job.
Google around for FMOD and Mac, and maybe you find something easier to implement. I’ll do some research too, and let you know about what I’ve found.