类型或命名空间名称“AsyncOperationHandle”找不到
刚刚开始尝试统一使用 Addressables,但我收到了“未找到命名空间”异常,即使我拥有 Unity Addressables 1.19.19 统一文档中的所有“using”语句和正确类型。
代码:
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using ONSDK.Utility; // Personal utility class.
namespace ONSDK.PlayerModel
{
public class PlayerModelManager : Singleton<PlayerModelManager> // Singleton<> is provided by 'ONSDK.Utility'.
{
private AsyncOperationHandle<GameObject> handle; // The "missing" type.
private void Start()
{
// Gonna load a player model here.
}
}
}
附注: 该脚本位于具有引用 Unity.Addressables 程序集定义的程序集定义的文件夹中,所有 using 语句都很好,但只是找不到 AsyncOperationHandle 类型,即使它位于由使用声明...
Just got started trying to work with Addressables in unity, but I've been provided with the "namespace not found" exception, even though I have all the 'using' statements and the correct type from the unity documentation for Unity Addressables 1.19.19.
The code:
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using ONSDK.Utility; // Personal utility class.
namespace ONSDK.PlayerModel
{
public class PlayerModelManager : Singleton<PlayerModelManager> // Singleton<> is provided by 'ONSDK.Utility'.
{
private AsyncOperationHandle<GameObject> handle; // The "missing" type.
private void Start()
{
// Gonna load a player model here.
}
}
}
Side note:
The script is located in a folder with an Assembly Definition that is referencing the Unity.Addressables assembly definition, all using statements are fine, but its just the AsyncOperationHandle type that just isn't found, even though it's in the AsyncOperations class provided by the using statement...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于任何发现自己处于这种情况的人,将代码分离到单独的程序集定义中;请务必引用这些程序集定义,以便您可以在代码中使用可寻址:
To anyone that finds them selves in this situation of, separating your code into a separate assembly definition; be sure to reference these assembly definitions so you can use addressable in your code: