I know in general that the FFT algorithm should return an array of a complex number, but the function GetSpectrumData in Unity returns an array of floats which represent the amplitude of the frequency, My question: Why Unity returns a float and not a complex number? and does this float number is the magnitude of the complex number?
GetSpectrumData only returns the spectrum, not the full FFT. Yes, the values should be the magnitude of the complex values. If you’re looking for another FFT solution, I’ve written one over here. It includes a custom Complex struct which may be used for any cases where a complex number may be useful.
If you want to analyse the audio output (like GetSpectrumData) you can use OnAudioFilterRead. Though be careful, this callback is invoked from the audio thread. So you can not directly use most of the Unity API inside that callback.