コード例 #1
0
        internal void Reset()
        {
            if (m_SerialId <= 0)
            {
                throw new InvalidOperationException("Already reset.");
            }

            m_AssetCache.RemoveAccessor(this);
            ResetCallbacks();

            m_AssetCache.ReduceRetainCount();
            m_AssetCache = null;
            m_SerialId   = 0;
        }
コード例 #2
0
        internal void Init(AssetCache assetCache, LoadAssetCallbackSet callbackSet, object context)
        {
            if (m_SerialId > 0)
            {
                throw new InvalidOperationException("Oops, I'm not reset.");
            }

            m_AssetCache = assetCache ?? throw new ArgumentNullException(nameof(assetCache), "Oops!");
            m_SerialId   = NextSerialId();

            m_AssetCache.IncreaseRetainCount();

            CallbackSet = callbackSet;
            Context     = context;
            m_AssetCache.AddAccessor(this);
        }