Exemple #1
0
 public T GetAsset <T>() where T : UnityObject
 {
     if (Proxy.IsEditor())
     {
         if (this.asset.IsNull())
         {
             this.asset = ProxyEditor.LoadAsset(this.GetAssetPath(), typeof(T)).As <T>();
         }
         return(this.asset.As <T>());
     }
     return(default(T));
 }
Exemple #2
0
 public static T GetAsset <T>(UnityObject target)
 {
                 #if UNITY_EDITOR
     if (Proxy.IsEditor())
     {
         if (!File.assets.ContainsKey(target))
         {
             string assetPath = File.GetAssetPath(target);
             object asset     = ProxyEditor.LoadAsset(assetPath, typeof(T));
             if (asset == null)
             {
                 return(default(T));
             }
             File.assets[target] = Convert.ChangeType(asset, typeof(T));
         }
         return((T)File.assets[target]);
     }
                 #endif
     return(default(T));
 }