Game Development Reference
In-Depth Information
{
get
{
return "Welcome to Windows 8";
}
}
}
}
As you can see, it has the same namespace, same class name, and same property as our
editor class, but now the implementation has changed.
Note
This is just a very simple example; the real platform implementation could have any
platform-specific code within it, as it will be executed against the platform when de-
ployed.
Accessing the plugin
So, we have our editor (mock) and platform (Windows 8) plugins defined; you just need
to copy them to your Unity project. Now, perform the following steps:
1. Copy the DLL from the Windows 8 class library to As-
sets\Plugins\Metro .
2. Copy the DLL from the editor class library in Assets\Plugins (if re-
quired—.NET only).
Tip
Although not critical, it's best to name the two DLLs and any others you create for other
platforms using the same DLL name. This just makes it easier to manage later if you need
to add more to the plugin.
With your DLLs now in your project, you can access the plugin from anywhere in your
Unity project by calling the following code:
string WhatsMyPlatform =
MyAwesomePlugin.MyPluginClass.GetPlatform;
When you run the project from the editor, this will return in the following manner:
Search WWH ::




Custom Search