/// <summary>
        /// Posts this Event on a GameObject.
        /// </summary>
        /// <param name="gameObject">The GameObject</param>
        /// <param name="flags"></param>
        /// <param name="callback"></param>
        /// <param name="cookie">Optional cookie received by the callback</param>
        /// <returns>Returns the playing ID.</returns>
        public uint Post(GameObject gameObject, CallbackFlags flags, AkCallbackManager.EventCallback callback, object cookie = null)
        {
            if (!IsValid())
            {
                return(AkSoundEngine.AK_INVALID_PLAYING_ID);
            }

            uint playingId = AkSoundEngine.PostEvent(GetID(), gameObject, flags.value, callback, cookie);

            VerifyPlayingID(playingId);
            return(playingId);
        }
Beispiel #2
0
        /// <summary>
        ///     Posts this Event on a GameObject.
        /// </summary>
        /// <param name="gameObject">The GameObject</param>
        /// <param name="flags"></param>
        /// <param name="callback"></param>
        /// <param name="cookie">Optional cookie received by the callback</param>
        /// <returns>Returns the playing ID.</returns>
        public uint Post(UnityEngine.GameObject gameObject, CallbackFlags flags, AkCallbackManager.EventCallback callback,
                         object cookie = null)
        {
            if (!IsValid())
            {
                return(AkSoundEngine.AK_INVALID_PLAYING_ID);
            }

#if AK_WWISE_ADDRESSABLES && UNITY_ADDRESSABLES
            var args     = new object[] { gameObject, flags, callback, cookie };
            var argTypes = new System.Type[] { typeof(UnityEngine.GameObject),
                                               typeof(CallbackFlags), typeof(AkCallbackManager.EventCallback), typeof(object) };
            if (!AkAddressableBankManager.Instance.LoadedBankContainsEvent(Name, Id, this, "Post", argTypes, args))
            {
                return(AkSoundEngine.AK_PENDING_EVENT_LOAD_ID);
            }
#endif

            m_playingId = AkSoundEngine.PostEvent(Id, gameObject, flags.value, callback, cookie);
            VerifyPlayingID(m_playingId);
            return(m_playingId);
        }