private void SetupDependencies(string[] dependencies) { if (dependencies == null || dependencies.Length == 0) { return; } if (dependencies.Length > 63) { throw new Exception($"{ABPath} dependencies count > 64."); } m_dependencies = new AssetBundleInstance[dependencies.Length]; var service = CSharpServiceManager.Get <AssetService>(CSharpServiceManager.ServiceType.ASSET_SERVICE); for (int i = 0; i < m_dependencies.Length; i++) { var hash = GenerateHash(dependencies[i]); if (!(service.Container.TryGetAsset(hash) is AssetBundleInstance dep)) { dep = new AssetBundleInstance(dependencies[i]); } dep.IncRef(); m_dependencies[i] = dep; } }
public virtual void SetAsset(Object unityObj, AssetBundleInstance refAssetBundle) { UnityObject = unityObj; if (refAssetBundle != null) { RefAssetBundle = refAssetBundle; RefAssetBundle.IncRef(); } Status = UnityObject ? AssetStatus.DONE : AssetStatus.FAIL; if (Status == AssetStatus.DONE) { StatService.Get().Increase(StatService.StatName.ASSET_COUNT, 1); CreateTime = Time.realtimeSinceStartup; #if UNITY_DEBUG var service = CSharpServiceManager.Get <AssetFullStatService>(CSharpServiceManager.ServiceType.ASSET_FULL_STAT); service.OnAssetLoaded(this); #endif } }