protected internal override void Release(bool isShutdown)
                {
                    if (!isShutdown)
                    {
                        int targetReferenceCount = 0;
                        if (m_ResourceLoader.m_AssetDependencyCount.TryGetValue(Target, out targetReferenceCount) && targetReferenceCount > 0)
                        {
                            throw new GameFrameworkException(Utility.Text.Format("Asset target '{0}' reference count is '{1}' larger than 0.", Name, targetReferenceCount.ToString()));
                        }

                        foreach (object dependencyAsset in m_DependencyAssets)
                        {
                            int referenceCount = 0;
                            if (m_ResourceLoader.m_AssetDependencyCount.TryGetValue(dependencyAsset, out referenceCount))
                            {
                                m_ResourceLoader.m_AssetDependencyCount[dependencyAsset] = referenceCount - 1;
                            }
                            else
                            {
                                throw new GameFrameworkException(Utility.Text.Format("Asset target '{0}' dependency asset reference count is invalid.", Name));
                            }
                        }

                        m_ResourceLoader.m_ResourcePool.Unspawn(m_Resource);
                    }

                    m_ResourceLoader.m_AssetDependencyCount.Remove(Target);
                    m_ResourceLoader.m_AssetToResourceMap.Remove(Target);
                    m_ResourceHelper.Release(Target);
                }
Example #2
0
        protected override internal void Release(bool isShutdown)
        {
            if (!isShutdown)
            {
                int targetReferenceCount = 0;
                if (m_ResourceLoader.ResourceDependencyCount.TryGetValue(Target, out targetReferenceCount) && targetReferenceCount > 0)
                {
                    throw new Exception(Utility.Text.Format("Resource target '{0}' reference count is '{1}' larger than 0.", Name, targetReferenceCount.ToString()));
                }

                foreach (object dependencyResource in m_DependencyResources)
                {
                    int referenceCount = 0;
                    if (m_ResourceLoader.ResourceDependencyCount.TryGetValue(dependencyResource, out referenceCount))
                    {
                        m_ResourceLoader.ResourceDependencyCount[dependencyResource] = referenceCount - 1;
                    }
                    else
                    {
                        throw new Exception(Utility.Text.Format("Resource target '{0}' dependency asset reference count is invalid.", Name));
                    }
                }
            }

            m_ResourceLoader.ResourceDependencyCount.Remove(Target);
            m_ResourceHelper.Release(Target);
        }
 protected internal override void Release()
 {
     m_ResourceHelper.Release(Target);
 }
 protected internal override void Release()
 {
     m_ResourceHelper.Release(Target);
     m_ResourcePool.Unspawn(m_Resource);
 }
Example #5
0
 protected internal override void Release(bool isShutdown)
 {
     m_ResourceHelper.Release(Target);
 }