Create a WP8 plugin for unity

Source: Internet
Author: User

Objective:

When you publish WP8 apps with unity, you often encounter situations where the API isn't working, such as popping the MessageBox, not using String.Compare (String,string,bool), and so on. So how do we solve these problems? One of the solutions is to make plugins. There is an article in Unity Manual: http://docs.unity3d.com/Manual/wp8-plugins-guide-csharp.html is about making Unity's WP8 plugin. I'll describe the process in Chinese. Because of limited capacity, if there is anything wrong, I hope you great God help ha! Thank you!

1. Create a new blank solution as shown in:

    

2, to the Blank solution, add a project

    

3, this new project is a C # class library project, we name it Fakedll, in particular, to choose the. NET Framework 3.5, as shown:

  

4. After this project is built, we will add a C # WP8 class Library project to that solution. Note At this time, you should choose the. NET Framework 4.5 and later, we are named Realdll:

  

5. The following is the most critical step: Change the "assembly name" and "Default namespace" in the two class library properties to the name of the solution, as shown in:

  

Because the default namespace is changed, the corresponding changes are made in class as well.

6, the next is to write code, we fakedll the class to write unity can use some of the functions, in the Realdll class write WP in the actual use, as shown in the following code:

Fakedll:
  

Realdll:

  

7. Select two items to generate the DLL, as shown in:

  

The generated DLLs are located at: realdll:\unitywpplugins\realdll\bin\debug; Fakedll:\unitywpplugins\fakedll\bin\debug, copy the two fakedll generated files to the Assets/plugins folder in Unity, Copy the two files generated by Realdll to the Assets/plugins/wp8 folder in unity, as shown in:

  

8. Finally in unity we can invoke the GetDevice method in Class1 under the Unitywpplugins namespace. The results are as follows on the Unity editor and WP Real machine:

Code:

  

Editor:

  

WP8:

  

  This method is also useful for making Windows Store apps and Windows Universal apps.

Create a WP8 plugin for unity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.