UnityEditor.iOS.Resource - Does not exist

Hi,

I am trying to use on-demand resources, and I have the following script in my Editor folder, however it just constantly complains about missing namespaces. So, is this the right place for it? - is there another problem?

#if ENABLE_IOS_ON_DEMAND_RESOURCES || ENABLE_IOS_APP_SLICING
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
#if UNITY_IOS
using UnityEditor.iOS;
#endif

public class BuildResources
{
    [InitializeOnLoadMethod]
    static void SetupResourcesBuild()
    {
        UnityEngine.Debug.Log ("SetupResourcesBuild COLLECT");
       
        UnityEngine.Debug.Log ("SetupResourcesBuild COLLECTING");
        UnityEditor.iOS.BuildPipeline.collectResources += CollectResources;
    }
       
    static string GetPath(string relativePath)
    {
        string root = Path.Combine(AssetBundles.Utility.AssetBundlesOutputPath,
                                   AssetBundles.Utility.GetPlatformName());
        return Path.Combine(root, relativePath);
    }

    static UnityEditor.iOS.Resource[] CollectResources()
    {
        string manifest = AssetBundles.Utility.GetPlatformName();
        return new Resource[]
        {
            new Resource(manifest, GetPath(manifest)).AddOnDemandResourceTags(manifest),
            new Resource("twcanyon", GetPath("twcanyon")).AddOnDemandResourceTags("twcanyon")
        };
    }

}
#endif

Here’s a screenshot of the error:

You need to move your script to the Editor folder

Oh man, thanks for your comment. I thought I was going crazy. I didn’t see this documented anywhere so I spent way too much time wondering why it was broken. Creating a /Assets/Editor folder and copying my class there fixed the issue. Unity, please add this requirement to the documentation of these classes.