public static Transform InitAudioSourceFollower(Transform transToFollow, string followerName, string soundGroupName, string variationName, float volume, bool willFollowSource, bool willPositionOnClosestColliderPoint, bool useTopCollider, bool useChildColliders, MasterAudio.AmbientSoundExitMode exitMode, float exitFadeTime, MasterAudio.AmbientSoundReEnterMode reEnterMode, float reEnterFadeTime) { if (ListenerFollower == null || FollowerHolder == null) { return(null); } var grp = MasterAudio.GrabGroup(soundGroupName); if (grp == null) { return(null); } if (grp.groupVariations.Count == 0) { return(null); } SoundGroupVariation variation = null; if (!string.IsNullOrEmpty(variationName)) { variation = grp.groupVariations.Find(delegate(SoundGroupVariation v) { return(v.name == variationName); }); if (variation == null) { Debug.LogError("Could not find Variation '" + variationName + "' in Sound Group '" + soundGroupName); return(null); } } else { variation = grp.groupVariations[0]; } var triggerRadius = variation.VarAudio.maxDistance; var follower = new GameObject(followerName); var existingDupe = FollowerHolder.GetChildTransform(followerName); if (existingDupe != null) { GameObject.Destroy(existingDupe.gameObject); } follower.transform.parent = FollowerHolder; follower.gameObject.layer = FollowerHolder.gameObject.layer; var followerScript = follower.gameObject.AddComponent <TransformFollower>(); followerScript.StartFollowing(transToFollow, soundGroupName, variationName, volume, triggerRadius, willFollowSource, willPositionOnClosestColliderPoint, useTopCollider, useChildColliders, exitMode, exitFadeTime, reEnterMode, reEnterFadeTime); _transformFollowers.Add(followerScript); return(follower.transform); }