Does UnitySetGraphicsDevice get called on the Windows Metro and WP8 Platforms?

Hello,

I’m working on porting my native PC plugin to Windows Metro and WP8. Does UnitySetGraphicsDevice get used on those platforms? It doesn’t seem to be firing for me.

Thanks!

Hello,

That function is used and should work. Could you describe how you’re trying to use them?

I took the MetroNativePluginsV1 sample and added a public int (test) to the top of Plugins.cpp. I then added the following:

int test = 0;

extern "C" int __declspec(dllexport) _stdcall GetInteger()
{
	if(test > 0)
		return test;
	else
		return 15;
}

// If exported by a plugin, this function will be called when graphics device is created, destroyed,
// before it's being reset (i.e. resolution changed), after it's being reset, etc.
extern "C" void __declspec(dllexport) UnitySetGraphicsDevice (void* device, int deviceType, int eventType)
{
	test = 20;
}

Test was never getting set to 20. I actually got UnitySetGraphicsDevice to trigger by adding the following line to the generated D3D11 C++ Application code (App.cpp – void App::SetWindow(CoreWindow^ coreWindow))

m_AppCallbacks->LoadGfxNativePlugin("Plugins.dll");

Is that the correct way to get UnitySetGraphicsDevice to trigger?

Thanks!

Yes, you have to call AppCallbacks::LoadGfxNativePlugin() in Windows Store Apps.

If you’re still interested, here’s a complete example which works on Windows Store Apps (both X86/ARM)

http://files.unity3d.com/tomas/Metro/Examples/RenderingPluginExample.zip

Check out RenderingPlugin\WSAVisualStudio2012 project for more information

Hi,
Since my question is close to the initial issue of this thread I ask away here.

I want to do the exactly same thing that the poster of the thread but for windows phone build (not for a windows store apps).
The problem is that I can’t access the member functions of AppCallbacks class such as LoadGfxNativePlugin() or InitializeD3DWindow() in App.xaml.cs.

Right now I’m really stuck and any help or suggestions will be appreciate.

Thank you.