public void AssetLoad() { this._asset = Resources.Load(this._assetPath); ResourceLoader.AssetTypes type = this._type; if (type != ResourceLoader.AssetTypes.Mesh) { if (type == ResourceLoader.AssetTypes.Texture) { ((Material)this._target).mainTexture = (Texture)this._asset; } } else { ((MeshFilter)this._target).mesh = (Mesh)this._asset; } }
public void AssetUnload(bool resourceUnload) { ResourceLoader.AssetTypes type = this._type; if (type != ResourceLoader.AssetTypes.Mesh) { if (type == ResourceLoader.AssetTypes.Texture) { ((Material)this._target).mainTexture = null; } } else { ((MeshFilter)this._target).mesh = null; if (resourceUnload) { Resources.UnloadAsset(this._asset); } } this._asset = null; }
private void OnDisable() { Dictionary <string, int> inUseAssetsCounters; Dictionary <string, int> expr_05 = inUseAssetsCounters = ResourceLoader.InUseAssetsCounters; string assetPath; string expr_0D = assetPath = this._assetPath; int num = inUseAssetsCounters[assetPath]; if ((expr_05[expr_0D] = num - 1) == 0) { UnityEngine.Object asset = this._asset; this._asset = null; ResourceLoader.AssetTypes type = this._type; if (type == ResourceLoader.AssetTypes.Mesh) { ((MeshFilter)this._target).mesh = null; Resources.UnloadAsset(asset); } ResourceLoader.InUseAssetsCounters.Remove(this._assetPath); } }