Search Unity

List with obsolete API?

Discussion in 'Unity 5 Pre-order Beta' started by anfemaPeter, Oct 27, 2014.

  1. anfemaPeter

    anfemaPeter

    Joined:
    May 29, 2013
    Posts:
    14
    Is there any info about obsolete API?
    I can't find anything in the ScriptReference about obsolete functions and their replacements :(

    e.g.:
    The type or namespace name `ResourceRequest' could not be found. Are you missing a using directive or an assembly reference?
     
  2. Dreamzle

    Dreamzle

    Joined:
    Apr 23, 2014
    Posts:
    43
    The project converter automatically replaces obsolete API calls if you want, so you could let it do so and then diff to figure out what the changes were.
     
  3. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    252
    Hi.

    I am one of the devs in charge of the automatic API updating infrastructure. I checked and did not find any configuration for this type. I'll investigate more and get back to you.
     
    shkar-noori likes this.
  4. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    354
    I also noticed that this class is missing. Which means, we can't use Resources.LoadAsync currently.
     
  5. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    591
    This API was added in a patch release; unfortunately, it will not come back in 5.
     
  6. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    354
    ok.. do you mean Resources.LoadAsync will not come back, or just ResourceRequest? Is there a new way of loading resources in the background?
     
  7. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    252
    Hi, after discussing with the engineering team, we found out that the introduction of the type ResourceRequest and the related method Resources.LoadAsync() were not well planned and were not meant to be public, so we're going to mark them as obsolete in 5.0 (i.e, any code that uses it will at least generate a more informative compiler error).

    The AssetBundle class should be used instead of Resources.

    We're sorry for any inconvenience caused.

    Best

    Adriano
     
  8. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Does that mean that all Resources methods and the Resources directory are obsolete, or just Resources.LoadAsync()?

    Currently, for patching standalone games, the AssetBundle class uses some faraway temporary directory for the asset bundles it downloads and caches (certainly on Windows). It would be better if we could download patches to the game's own directory structure. For standalone games that require patching, the current AssetBundle system isn't perfect, it seems more tailored towards mobile and browser platforms.
     
  9. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    252
    Only Resources.LoadAsync() will be obsoleted (as error); the other Resources methods will still work (even though they may be eventually be obsoleted, but as warning, for 5.0).

    Best

    Adriano
     
  10. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    As far as the Resources goes, thanks for the heads up on that, Adriano. I'll make sure I don't use any of them in future projects.
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    We use Resources.LoadAsync extensively in our Master Audio plugin, for pro users only.

    Will there be a direct API replacement for Resources? I need to know how to retrofit our code to work in Unity 5 for when the deprecated Resource methods get removed. From what I understand about Asset Bundles (admittedly very little), they are not for the same scenarios as Resource files. Resource files would be loaded from the local device, and Asset Bundles would be loaded from a URL on the internet. Has that changed? Or are we totally losing the coolness of Resource files with nothing to replace it?
     
  12. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    We need Resources.LoadAsync back... When it came out I was so happy because we really needed it. Asset Bundles are a pain. I really vote to keep Resources.LoadAsync in Unity 5.... I don't see why not.
     
  13. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    I'm of the same mind. So far what I've seen of Asset Bundles, it's a pain.
     
  14. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    Yeah it's not something anyone loves. Resources.LoadAsync is probably my favorite addition I saw in Unity 4. I see no reason for them not to support it.
     
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    If we get enough votes, could the decision be reversed?
     
  16. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Could we have more documentation and a good set of examples for using Asset Bundles in all circumstances; streamed, and cached. I've watched the Unite presentation a number of times, and it's not much clearer on the fine points.
     
    DanSuperGP and chrismarch like this.
  17. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    If enough people vote for it, I'm sure they'd reverse it. Problem is, nobody will know it's gone till Unity 5 is fully released. Then people will complain, asking "Where's LoadAsync?". We probably have to wait till then.
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    My customers will know, I'll tell them right now on my thread and tell them to post here.
     
  19. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    This is absurd. Resources.LoadAsync was a HUGE feature, we're so surprised by its removal. Loading resources in the background was quite an useful thing to do.

    We were planning to upgrade to Unity 5 (that sexy 64-bit editor and the UI/Audio features are really appealing to us), but we should reconsider if that option is missing in the next Unity iterations.
     
    Last edited: Nov 20, 2014
    jerotas and Roni92 like this.
  20. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    We're discussing what to do about this.

    Bear in mind that the AssetBundle system has changed quite a bit in 5.0. I did a little experiment to see how difficult it would be to approximate the 'Resources bundle' - which, really, is just a special AssetBundle under the hood anyway - so as to get back an async-load behaviour. It turns out not to be too difficult:

    1) Tag the resources you want to load to be in a 'resources' bundle. You can do this via the UI (next to where asset labels are set up) or via the API.

    2) Create an editor script to build the asset bundle into the StreamingAssets folder. Something like this:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using UnityEditor;
    4.  
    5. public class BuildAssetBundles {
    6.  
    7.     [MenuItem("Tools/Build Asset Bundles")]
    8.     public static void Build()
    9.     {
    10.         System.IO.Directory.CreateDirectory (Application.streamingAssetsPath);
    11.         BuildPipeline.BuildAssetBundles (Application.streamingAssetsPath, BuildAssetBundleOptions.UncompressedAssetBundle | BuildAssetBundleOptions.CollectDependencies);
    12.         AssetDatabase.Refresh ();
    13.     }
    14. }
    15.  
    3) Run the script via the Tools menu to build an asset bundle from your resources.

    4) Add a script to load and expose the bundle as a singleton:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class MyResourcesBundle
    5. {
    6.     private static AssetBundle _bundle;
    7.     public static AssetBundle Get()
    8.     {
    9.         if (!_bundle)
    10.             _bundle = AssetBundle.CreateFromFile (System.IO.Path.Combine(Application.streamingAssetsPath, "resources"));
    11.  
    12.         return _bundle;
    13.     }
    14. }
    15.  
    5) Now you can pretty much swap "Resources.LoadAsync" for "MyResourcesBundle.Get().LoadAsync":

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class MyResourcesLoadTest : MonoBehaviour {
    6.  
    7.     IEnumerator Start () {
    8.  
    9.         var loadReq = MyResourcesBundle.Get ().LoadAssetAsync<Material> ("TestMaterial");
    10.         yield return loadReq;
    11.  
    12.         GetComponent<Renderer> ().material = (Material)loadReq.asset;
    13.     }
    14. }
    15.  
    It's not quite as automatic as Resources in the sense that you need to remember to run "Tools -> Build Asset Bundles" when you change something in your resources bundle - but it also means that if you haven't changed anything in the bundle, you can skip building it, making for a faster build time.

    Also, once you grok this kind of thing, it's much more flexible: you can pack your resources into different bundles and take control over loading/unloading them, to get substantially better memory usage than the built-in Resources bundle (which, IIRC, is entirely loaded at app startup and cannot be unloaded). Also, packing your resources into a larger number of smaller bundles allows you to get better build times by only rebuilding those bundles that you know have changed.

    Is this a reasonable workaround for now?
     
    Last edited: Jan 31, 2015
    Dave-Hampson and DanSuperGP like this.
  21. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    Yeah, that sounds good. Thanks for posting. I'll give this a shot when I have some time. Looks like a good way to go.
     
    superpig likes this.
  22. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    354
    Thanks for posting this example. It's simple, but it has one drawback: it doesn't work well for crossplatform projects.

    With an approach like this, we have to rebuild the bundles every time from scratch after switching the platform. A solution would be to keep the different asset bundles for standalone/android/ios in different folders (inside StreamingAssets), but currently there's no easy way to only include certain files for a given platform, so everything would be included.

    To avoid this, I'm using a similar approach currently: I save asset bundles in the project on top level in a folder, next to Assets. After building, I copy them to the StreamingAssets folder directly in the final build using PostProcessBuild, eg. to Game.app/Contents/Resources/Data/StreamingAssets/.

    I'm doing it this way because I want to be able to push the build button in the build window (or use cmd+b shortcut), instead of using a custom BuildPipeline.BuildPlayer. This approach works well, except for android builds, because the StreamingAssets folder is inside the apk and not accessible in the filesystem, so I can't copy any files there after build. To fix this problem, it would be necessary to put the files into StreamingAssets of the project *before* build, but there is no callback for that, unfortunately.

    I see two solutions from Unity-side that would make our lives easier when working with asset bundles:
    • The simple way: Expose a PreProcessBuild callback so we can put the right files in StreamingAssets and remove the unnecessary ones, so they can be included in builds automatically, working on all platforms including Android.
    • The nice way: allow us to select platforms for files in StreamingAssets in which they should be included, similar to the checkboxes when selecting plugins in U5.

    This is my bundle build script:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4. using UnityEditor.Callbacks;
    5. using System.IO;
    6.  
    7. public static class AssetBundleBuilder
    8. {
    9.     static string assetBundlesPath = "AssetBundles/";
    10.  
    11.     [MenuItem("Assets/Build Asset Bundles")]
    12.     public static void BuildForCurrentPlatform()
    13.     {
    14.         BuildForCurrentPlatform (EditorUserBuildSettings.activeBuildTarget);
    15.     }
    16.  
    17.     static void BuildForCurrentPlatform(BuildTarget target)
    18.     {
    19.         string assetBundleDir = GetAssetBundleDir (target);
    20.         EditorFileUtils.EnsureFolders (assetBundleDir);
    21.  
    22.         AssetDatabase.RemoveUnusedAssetBundleNames ();
    23.  
    24.         BuildAssetBundleOptions options = BuildAssetBundleOptions.None;
    25.  
    26.         if( UseUncompressedBundlesForPlatform(target))
    27.             options |= BuildAssetBundleOptions.UncompressedAssetBundle;
    28.  
    29.         BuildPipeline.BuildAssetBundles (assetBundleDir, options,target);
    30.     }
    31.  
    32.     public static bool UseUncompressedBundlesForPlatform (BuildTarget target)
    33.     {
    34.         if (target == BuildTarget.WebGL)
    35.             return false;
    36.         if (target == BuildTarget.WebPlayer)
    37.             return false;
    38.         return true;
    39.     }
    40.  
    41.     [PostProcessBuild]
    42.     public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
    43.     {
    44.         BuildForCurrentPlatform ();
    45.  
    46.         string srcFolder = GetAssetBundleDir (target);
    47.  
    48.         if (!Directory.Exists (srcFolder))
    49.             return;
    50.  
    51.         string targetFolder = GetStreamingAssetsPathInBuild(target,pathToBuiltProject) +"AssetBundles/";
    52.         EditorFileUtils.EnsureFolders (targetFolder);
    53.  
    54.         Debug.LogFormat( "Copy asset bundles from '{0}' to: {1}",srcFolder,targetFolder);
    55.  
    56.         EditorFileUtils.CopyDirectory (srcFolder, targetFolder,true, true, delegate(string obj) {
    57.        
    58.             return obj.Contains(".meta") || obj.Contains(".DS_Store");
    59.         });
    60.     }
    61.  
    62.     static string GetAssetBundleDir(BuildTarget target){
    63.  
    64.         if (target.ToString ().Contains ("Standalone"))
    65.         {
    66.             return assetBundlesPath + "default/";
    67.         }
    68.         else if (target == BuildTarget.iOS)
    69.         {
    70.             return assetBundlesPath + "ios/";
    71.        
    72.         }
    73.         else if (target == BuildTarget.WebGL)
    74.         {
    75.             return assetBundlesPath + "webgl/";
    76.        
    77.         }
    78.         else if (target == BuildTarget.Android)
    79.         {
    80.             return assetBundlesPath + "android/";
    81.         }
    82.         throw new UnityException("Platform not implemented (asset bundle dir)");
    83.     }
    84.  
    85.     static string GetStreamingAssetsPathInBuild(BuildTarget target, string pathToBuiltProject)
    86.     {
    87.         if (target.ToString ().Contains ("OSX"))
    88.         {
    89.             return pathToBuiltProject+"/Contents/Resources/Data/StreamingAssets/";
    90.         }
    91.         if (target.ToString ().Contains ("Windows"))
    92.         {
    93.             string name = pathToBuiltProject.Substring( pathToBuiltProject.LastIndexOf('/')+1).Replace(".exe","") ;
    94.             return pathToBuiltProject+"/"+name+"_Data/StreamingAssets/";
    95.         }
    96.         if (target== BuildTarget.iOS)
    97.         {
    98.             return pathToBuiltProject+"/Data/Raw/";
    99.         }
    100.         if (target== BuildTarget.WebGL || target == BuildTarget.WebPlayer)
    101.         {
    102.             return pathToBuiltProject+"/StreamingAssets/";
    103.         }
    104.  
    105.         throw new UnityException("Platform not implemented");
    106.     }
    107. }
    108.  
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4. using System.IO;
    5.  
    6. public static class EditorFileUtils {
    7.  
    8.     public delegate bool DirCopyIncludeCheck (string name);
    9.     public static void CopyDirectory(string sourceDirName, string destDirName, bool copySubDirs, bool overwrite,DirCopyIncludeCheck ignore=null)
    10.     {
    11.         // Get the subdirectories for the specified directory.
    12.         DirectoryInfo dir = new DirectoryInfo(sourceDirName);
    13.         DirectoryInfo[] dirs = dir.GetDirectories();
    14.      
    15.         if (!dir.Exists)
    16.         {
    17.             throw new DirectoryNotFoundException(
    18.                 "Source directory does not exist or could not be found: "
    19.                 + sourceDirName);
    20.         }
    21.      
    22.         // If the destination directory doesn't exist, create it.
    23.         if (!Directory.Exists(destDirName))
    24.         {
    25.             Directory.CreateDirectory(destDirName);
    26.         }
    27.      
    28.         // Get the files in the directory and copy them to the new location.
    29.         FileInfo[] files = dir.GetFiles();
    30.         foreach (FileInfo file in files)
    31.         {
    32.             if(ignore != null && ignore(file.Name))
    33.                 continue;
    34.          
    35.             string temppath = Path.Combine(destDirName, file.Name);
    36.             file.CopyTo(temppath, overwrite);
    37.         }
    38.      
    39.         // If copying subdirectories, copy them and their contents to new location.
    40.         if (copySubDirs)
    41.         {
    42.             foreach (DirectoryInfo subdir in dirs)
    43.             {
    44.                 if(ignore != null && ignore(subdir.Name))
    45.                     continue;
    46.              
    47.                 string temppath = Path.Combine(destDirName, subdir.Name);
    48.                 CopyDirectory(subdir.FullName, temppath,overwrite, copySubDirs,ignore);
    49.             }
    50.         }
    51.     }
    52.     public static void EnsureFolders(string path)
    53.     {
    54.         path = path.Replace('\\', '/');
    55.         string[] folders = path.Split('/');
    56.         for (int i = 0; i < folders.Length - 1; i++)
    57.         {
    58.             string currentpath = folders[i];
    59.             if (i > 0)
    60.             {
    61.                 for (int j = i - 1; j >= 0; j--)
    62.                     currentpath = folders[j] + '/' + currentpath;
    63.             }
    64.             if (currentpath == "") continue;
    65.             if (!Directory.Exists(currentpath))
    66.             {
    67.                 Directory.CreateDirectory(currentpath);
    68.             }
    69.         }
    70.     }
    71. }

    Another thing that gave me some headaches in the transition from resouces to asset bundles:
    In asset bundles we have no paths, so it's not clear to me what happens if two assets in different folders have the same name. I'm not sure if I did something else wrong, but when trying to develop out the system above I ran into problems when loading an object, if another object is included in the same bundle with the same name. Even if they have different types and were initially located in different folders, it didn't work to load it with Load<T>.

    Eg. i tried to load objects of type CustomScriptableObject like this. Some of them have a texture referenced with the same name, which are included when building the asset bundles.

    Code (CSharp):
    1. public class CustomScriptableObject : ScriptableObject
    2. {
    3.    public Texture texture;
    4. }
    Code (CSharp):
    1.  
    2. Files:
    3. Assets/object1.asset
    4. Assets/object1.png
    5. Assets/object2.asset
    6. Assets/object2.png
    7. ...
    8.  
    objectX.asset has a texture objectX.png referenced, which is included as a dependency in the asset bundle. So if I load an object, this happens.

    Code (CSharp):
    1.  
    2. var myObject1 = myAssetBundle.Load<CustomScriptableObject>("object1");  // works
    3. var myObject2 = myAssetBundle.Load<CustomScriptableObject>("object2");  // doesn't work
    4. var myTexture2 = myAssetBundle.Load<Texture>("object2");  // works
    5.  
    Sometimes it works, sometimes not. What is the expected behaviour of this? Is it a bug or am I doing something wrong? My working solution was to add a prefix to the name of all assets of one type.

    Sorry for the long post.. anyway my point is, that after being a bit disappointed by the removal of Resources.LoadAsync, I find that there are only some minor workflow improvements needed to make it almost as simple with asset bundles as before.
     
    Last edited: Dec 23, 2014
    DanSuperGP likes this.
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    This sounds like a non-flexible PITA right now. Unity 5 users of our plugins will have do without Async support until there's something more fleshed out and robust. And they're not happy about it. Neither am I.

    I haven't heard a good reason why you guys (Unity) don't just add the LoadAsync method for Resources back in until such time there's an all-platform workaround. I mean, it's already exposed in Unity 4. Normally in software, things are marked as deprecated in the next version (but still work), and then removed in the version after that. Whereas Unity decides to just up and remove it entirely instead of deprecating it. We can't even compile. It's not an acceptable situation and we still hope Unity finds a way to rectify it.
     
  24. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    Right - and both of those would be useful in many, many more situations than just this one, so I'm very interested in them.

    The per-asset platform including stuff for StreamingAssets is hard because 99% of the editor doesn't consider StreamingAssets a special folder - in theory you can drop a texture into StreamingAssets and then use it like any other texture in your project, and for that to work the texture import settings still need to be settable. Should we let you do that, considering that it defeats the point of putting stuff in the StreamingAssets folder (as the texture will be pulled into the build's packed data the same way as any other texture)? Perhaps not, but it's a breaking change so we have to consider it carefully.

    Good point. Let me look into that for you.

    Right. I think that even if we do implement Resources.LoadAsync for Unity 5, we should be aiming to make these improvements to the asset bundle workflow anyway, so this is super helpful feedback, thank you :)
     
  25. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    When did you last test that? It looks to me like we added a stubbed-out, [Obsolete]-marked version of the function around November 20th, so your code should at least be compiling now.

    To be clear, while I'm talking about workarounds for it here, we have not made a decision one way or the other - the conversation is still ongoing internally. On the one hand we don't want to create breaking changes in 5.0 just for the sake of it; on the other hand, we want to avoid redundancy in our API and codebase. (Truth is, the API kinda sneaked past our internal review processes and then crept out in a patch release - had things gone differently I suspect we would never have added it in the first place, knowing what was coming for the AssetBundle API).

    You say "until such time [as] there's an all-platform workaround" - well, my personal hope is that we can implement such a workaround for 5.0 :)
     
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    I downloaded Unity 5 beta 17 on December 14th and tested it. That one still does not compile:

    error CS0619: `UnityEngine.Resources.LoadAsync(string, System.Type)' is obsolete: `Resources.LoadAsync(string, Type) has been obsoleted. Please, use AssetBundle.LoadAssetAsync<T>() instead.'

    Possible that beta 18 has this downgraded to a warning. Downloading now.
     
  27. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    After reading all these posts about asset bundles and such... I still hate asset bundles. Resources.LoadAsync is so much more convenient. I don't see why we can't have both. If the asset bundle system is that much better than people will use it naturally, but for others who simply want to drag a prefab into resources, and hit play we can't do that, we have to spend a lot more time dealing with bundles.

    I am working on a game that is supposed to load thousands of items & npcs asynchronously. This means I have to make thousands of asset bundles. Please deeply consider bringing back resources.LoadAsync. Why have resources.load and not async?

    Thanks for considering this.
     
  28. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    No it doesn't. You can pack them all into one big bundle.
     
  29. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    My bad, I didn't see that the ObsoleteAttribute was set to generate a compile error rather than a warning.

    Considering that the method will just throw an exception if you call it at the moment, is there still value to you to downgrading that to a warning? Seems like you'd just want to do #if !UNITY_5/#endif around it at the moment.
     
  30. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    Ah alright. I apologize for that.
    Ah alright. I still am not a fan personally though of asset bundles. The loading seems fine now that you brought it to my attention, but I still definitely prefer using resources.
     
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    Correct, if it doesn't work then no point calling it. I have done what you suggest last month, with conditional compilation. Currently that means Master Audio users on Unity 4 have an additional feature that Unity 5 users don't have, which is a very strange situation that I want to rectify but can't currently...
     
  32. Phelioz

    Phelioz

    Joined:
    Nov 25, 2013
    Posts:
    7
    Sounds very good, if there is big performance improvement with using asset bundles instead of doing the regular Resource.LoadAsync I see no problem with switching it out. I mean Unity 5 is a whole new version if it is going to evolve you can't stay backwards compatible with everything. Just show us a good tutorial or some documentation on how to use the new asset bundle system.
     
  33. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,544
    Isn't AssetBundle pro-feature only, while Resources wasn't? So, how are Free user gonna load anything now that Resources is gone for them?
     
  34. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    Resources as a whole isn't gone, only Resources.LoadAsync.
     
  35. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,544
    Thanks for the precision.
     
  36. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    383
    You can count me in among the group of people why just don't understand why this was removed and would very much like it back.
     
  37. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Resources.LoadAsync was great. The lack of it in Unity 5 has sort of broken my project now, unfortunately, and will mean that I have to manually go through and tag everything in my Resources folder and build asset bundles from them. Overall a bit of a pain...
     
  38. Dr-KungFu

    Dr-KungFu

    Joined:
    Aug 11, 2014
    Posts:
    1
    Hi, We have an old project running on unity 4.3.4 and we are planning to update it.
    Can someone tell me if Resources.LoadAsync is still present in release 4.6.1?
    Thank you!
     
  39. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Yes, I used it in my 4.6 project before I started upgrading to Unity 5.
     
  40. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    It's still in 4.6.1.

    I'm working to get a full implementation into Unity 5 ASAP - watch this space, I'll keep you all updated.
     
    ZTORION, PhobicGunner and jerotas like this.
  41. bsterling250DI

    bsterling250DI

    Joined:
    Sep 25, 2014
    Posts:
    60
    i'm surprised at the level of concern around this, AssetBundles are waaaaay more useful, dynamic, and easy to automate.

    stuff in your Resources folder gets pulled into your build at build time, assetbundles can be built entirely in seperate pipelines and even in separate projects.

    You could even have an entire game release that is 99% data driven in that the only thing built into the client are the scripts and a url to a manifest.

    you could completely change your game just by changing the url to the manifest and loading different bundles.

    if you even have the url be relative to something like the url your webplayer is hosted on, you could make multiple games that all share the same scripts without even having to compile code more than once.

    None of this is possible with the Resources folder since they have to be in each individual project at runtime. Thus making it so any shared components between projects are duplicated and require dependency management, which without maven, is sorely lacking in unity up until 5.0
     
  42. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    They're kind of a pain in the ass to use during development, however. Actually, my reason for using LoadAsync was to provide a wrapper around both Resources and Asset Bundles, the idea being during development I can stuff things into special folders and pretend they're in an asset bundle, then later I can actually pack them into asset bundles without having to change my code.
     
  43. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    That's great news!
     
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    Hell yes! Keep up the great work, it's much appreciated.
     
  45. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    Should be in Beta 22.
     
    chrismarch, ZTORION and hippocoder like this.
  46. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    Awesome! Thanks for adding that superpig.
     
  47. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    That's perfect!
     
  48. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    People are reporting to me though that other Resource code API has been deprecated in beta 22 and doesn't compile (downloading it now). Should it all be easily fixable on my end without requiring people to use Asset Bundles?
     
  49. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,237
    If they're talking about Resources.LoadAssetAtPath, then yeah, you just need to put #if UNITY_EDITOR around it. (It only ever returned NULL outside of the editor anyway).
     
  50. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,057
    It is that. I just changed it to Resources.Load. Works on all versions of Unity.
     
unityunity