public static void Copy(this AudioSource target, AudioSource source, bool useCustomCurves = true)
{
target.enabled = source.enabled;
target.clip = source.clip;
target.mute = source.mute;
target.bypassEffects = source.bypassEffects;
target.bypassListenerEffects = source.bypassListenerEffects;
target.bypassReverbZones = source.bypassReverbZones;
target.playOnAwake = source.playOnAwake;
target.loop = source.loop;
target.priority = source.priority;
target.volume = source.volume;
target.pitch = source.pitch;
target.dopplerLevel = source.dopplerLevel;
target.rolloffMode = source.rolloffMode;
target.minDistance = source.minDistance;
target.spatialBlend = source.spatialBlend;
target.spread = source.spread;
target.maxDistance = source.maxDistance;
target.panStereo = source.panStereo;
target.time = source.time;
target.timeSamples = source.timeSamples;
target.velocityUpdateMode = source.velocityUpdateMode;
target.ignoreListenerPause = source.ignoreListenerPause;
target.ignoreListenerVolume = source.ignoreListenerVolume;
target.spatialize = source.spatialize;
if (useCustomCurves)
{
target.SetCustomCurve(AudioSourceCurveType.CustomRolloff, source.GetCustomCurve(AudioSourceCurveType.CustomRolloff));
target.SetCustomCurve(AudioSourceCurveType.ReverbZoneMix, source.GetCustomCurve(AudioSourceCurveType.ReverbZoneMix));
target.SetCustomCurve(AudioSourceCurveType.SpatialBlend, source.GetCustomCurve(AudioSourceCurveType.SpatialBlend));
target.SetCustomCurve(AudioSourceCurveType.Spread, source.GetCustomCurve(AudioSourceCurveType.Spread));
}
}