데스크톱 플랫폼용 플러그인은 C, C++, Objective C에서 작성할 수 있는 네이티브 코드 라이브러리입니다. 이 페이지에서는 macOS, Windows, Linux용 플러그인에 대해 설명합니다. 자세한 내용은 네이티브 플러그인을 참조하십시오.
macOS 플러그인을 번들로 배포하거나 IL2CPP 스크립팅 백엔드를 사용하고 있는 경우 [DllImport("__Internal")]
구문으로 호출할 수 있는 느슨한 C++파일을 배포할 수 있습니다. 느슨한 C++ 플러그인에 대한 자세한 내용은 IL2CPP를 위한 C++ 소스 코드 플러그인을 참조하십시오.
XCode를 사용하여 번들 프로젝트를 생성하려면 다음 단계를 따르십시오.
XCode를 사용하여 작업하는 데 대한 자세한 내용은 Apple의 Xcode에 대한 문서를 참조하십시오.
extern "C"
{
float ExamplePluginFunction ();
}
IL2CPP를 사용하고 있는 경우 Windows의 플러그인은 익스포트된 함수를 가진 .dll 파일이나 느슨한 C++ 파일입니다. .dll 파일을 만들어 플러그인을 생성할 수 있는 대부분의 언어와 개발 환경을 사용할 수 있습니다. 네임 맹글링 문제를 피하기 위해 반드시 C링크에 모든 C++ 함수를 선언해야 합니다.
Linux의 플러그인은 익스포트된 함수를 가진 .so 파일입니다. 이러한 라이브러리는 보통 C 또는 C++에 있지만 모든 언어를 사용할 수 있습니다. 네임 맹글링 문제를 피하기 위해 반드시 C링크에 모든 C++ 함수를 선언해야 합니다.
Unity에서 플러그인 인스펙터는 플러그인을 관리합니다. 플러그인 인스펙터에 액세스하려면 프로젝트 창에서 플러그인 파일을 선택합니다. 스탠드얼론 플랫폼의 경우 해당 라이브러리와 호환될 수 있는 CPU 아키텍처를 선택할 수 있습니다. 크로스 플랫폼 플러그인의 경우 반드시 .bundle 파일(macOS용), .dll 파일(Windows용), .so 파일(Linux용)을 포함해야 합니다. Unity는 타겟 플랫폼에 알맞은 플러그인을 자동으로 선택하고 플레이어에 포함합니다. 자세한 내용은 플러그인 임포트와 설정을 참조하십시오.
빌드된 플러그인을 Assets 폴더 또는 Unity 프로젝트에 있는 적절한 아키텍처별 하위 디렉토리에 배치합니다. 그러면 Unity는 C# 스크립트에서 호출할 때 이름으로 플러그인을 찾습니다. 예: [DllImport ("PluginName")] private static extern float ExamplePluginFunction ();
참고: PluginName
은 라이브러리 접두사 또는 파일 확장자를 포함해서는 안 됩니다. 예를 들어 플러그인 파일의 실제 이름은 Windows의 경우 PluginName.dll이고 Linux의 경우 libPluginName.so입니다.
이러한 프로젝트를 다운로드하고 사용하여 Unity에서 플러그인을 구현하는 방법을 배울 수 있습니다.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.