获取 'the type or namespace name' 尝试在 Unity3d 中进行 DllImport
Getting 'the type or namespace name' trying to DllImport in Unity3d
错误
Assets/Scripts/osx.cs(4,16): error CS0246: The type or namespace name `CoreGraphics' could not be found. Are you missing an assembly reference?
我的代码:
[DllImport ("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics")]
static extern CoreGraphics.CGSize CGDisplayScreenSize (uint display);
如何从 Unity3d 访问外部库?具体来说 CoreGraphics
对于 CGDisplayScreenSize
.
定义 ObjC return 类型,CoreGraphics.CGSize
用 C# 类型定义,你会没事的。
[Serializable]
public struct MyCGSize
{
public nfloat width;
public nfloat height;
}
[DllImport("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics")]
static extern MyCGSize CGDisplayScreenSize(uint display);
错误
Assets/Scripts/osx.cs(4,16): error CS0246: The type or namespace name `CoreGraphics' could not be found. Are you missing an assembly reference?
我的代码:
[DllImport ("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics")]
static extern CoreGraphics.CGSize CGDisplayScreenSize (uint display);
如何从 Unity3d 访问外部库?具体来说 CoreGraphics
对于 CGDisplayScreenSize
.
定义 ObjC return 类型,CoreGraphics.CGSize
用 C# 类型定义,你会没事的。
[Serializable]
public struct MyCGSize
{
public nfloat width;
public nfloat height;
}
[DllImport("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics")]
static extern MyCGSize CGDisplayScreenSize(uint display);