picpic2006
Topic Author
Posts: 71
Joined: 07 Nov 2013, 15:59

Windows Store Build

28 Aug 2015, 10:36

Hello,

I tried to build a completely new project for windows store, it is just the button exemple from your sample.

This is what i do !

1 First i switch plateform to windows store,

2 then i go to check my player setting,
I use Net Core,

3 i hit build.
"I have a error in console that say enable to patch file

Failed to patch file

UnityEngine.Debug:LogError(Object)
NoesisBuildPostprocessor:OnPostprocessBuildWSA(String) (at Assets/Editor/NoesisGUI/NoesisBuildPostprocessor.cs:36)
NoesisBuildPostprocessor:OnPostprocessBuild(BuildTarget, String) (at Assets/Editor/NoesisGUI/NoesisBuildPostprocessor.cs:14)

After i go in visual studio

https://drive.google.com/file/d/0B7tPUW ... sp=sharing

i check that my dll are here, i have a weird icon for them.

After the compile in VS
Exception de première chance à 0x75B74598 dans Template.exe : exception Microsoft C++ : Platform::FailureException ^ à l'emplacement de mémoire 0x0879CE6C. HRESULT:0x80004005 Erreur non spécifiée

Informations WinRT : NoesisError: NoesisUnityRenderHook library was not initialized

Trace de la pile :
[Code externe]
Noesis.dll!15a13b16()
Noesis.dll!15a13a62()
[Code externe]

S'il existe un gestionnaire pour cette exception, le programme peut continuer en toute sécurité.
I really don't see what to do ?

Ohhh i use unity 64 bit 5.1.2

Thanks you
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Windows Store Build

28 Aug 2015, 12:12

Hi,

First, make sure SDK is set to "8.1" (or "Phone 8.1" or "Universal 8.1" when appropriate).

Next, could you please verify that MainPage.xaml.cs exist in your project (it should!).

Since 1.2.4 we automatically try to patch that file adding the following line inside the MainPage() constructor (before Unity 5.1 changes were made to App.xaml.cs, inside InitializeUnity() function):
     appCallbacks.SetSwapChainPanel(mainPage.GetSwapChainPanel());
     appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
     appCallbacks.InitializeD3DXAML();
  +  appCallbacks.LoadGfxNativePlugin("NoesisUnityRenderHook.dll");
Thanks for your feedback.
 
picpic2006
Topic Author
Posts: 71
Joined: 07 Nov 2013, 15:59

Re: Windows Store Build

28 Aug 2015, 17:17

Yes bingo

i check this i needed to write this in your mainpage.xaml.cs and it work thanks


appCallbacks.LoadGfxNativePlugin("NoesisUnityRenderHook.dll");

By default it missing !

Update when i debug it in VS the sample load correctly but i have no input i can't clic any button !
Something is missing i think !
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Windows Store Build

28 Aug 2015, 20:08

This line should be added automatically by our BuildPostProcessor. Could you please post here the contents of the MainPage() constructor after you click the Build button and before manually patching that line?

About the input, wstore builds only provide Touch input in Unity, mouse is not available.
 
picpic2006
Topic Author
Posts: 71
Joined: 07 Nov 2013, 15:59

Re: Windows Store Build

28 Aug 2015, 20:56

this is the code !

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine.Windows;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
using UnityPlayer;

namespace Template
{
	/// <summary>
	/// An empty page that can be used on its own or navigated to within a Frame.
	/// </summary>
	public sealed partial class MainPage : Page
	{
		private WinRTBridge.WinRTBridge _bridge;
		
		private SplashScreen splash;
		private Rect splashImageRect;
		private WindowSizeChangedEventHandler onResizeHandler;

		public MainPage()
		{
			this.InitializeComponent();
			NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

			AppCallbacks appCallbacks = AppCallbacks.Instance;
			// Setup scripting bridge
			_bridge = new WinRTBridge.WinRTBridge();
			appCallbacks.SetBridge(_bridge);

			appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

#if !UNITY_WP_8_1
			appCallbacks.SetKeyboardTriggerControl(this);
#endif
			appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
			appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
			appCallbacks.InitializeD3DXAML();

			splash = ((App)App.Current).splashScreen;
			GetSplashBackgroundColor();
			OnResize();
			onResizeHandler = new WindowSizeChangedEventHandler((o, e) => OnResize());
			Window.Current.SizeChanged += onResizeHandler;

#if UNITY_WP_8_1
			SetupLocationService();
#endif
		}

		/// <summary>
		/// Invoked when this page is about to be displayed in a Frame.
		/// </summary>
		/// <param name="e">Event data that describes how this page was reached.  The Parameter
		/// property is typically used to configure the page.</param>
		protected override void OnNavigatedTo(NavigationEventArgs e)
		{
			splash = (SplashScreen)e.Parameter;
			OnResize();
		}

		private void OnResize()
		{
			if (splash != null)
			{
				splashImageRect = splash.ImageLocation;
				PositionImage();
			}
		}

		private void PositionImage()
		{
			var inverseScaleX = 1.0f;
			var inverseScaleY = 1.0f;
#if UNITY_WP_8_1
			inverseScaleX = inverseScaleX / DXSwapChainPanel.CompositionScaleX;
			inverseScaleY = inverseScaleY / DXSwapChainPanel.CompositionScaleY;
#endif

			ExtendedSplashImage.SetValue(Canvas.LeftProperty, splashImageRect.X * inverseScaleX);
			ExtendedSplashImage.SetValue(Canvas.TopProperty, splashImageRect.Y * inverseScaleY);
			ExtendedSplashImage.Height = splashImageRect.Height * inverseScaleY;
			ExtendedSplashImage.Width = splashImageRect.Width * inverseScaleX;
		}

		private async void GetSplashBackgroundColor()
		{
			try
			{
				StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///AppxManifest.xml"));
				string manifest = await FileIO.ReadTextAsync(file);
				int idx = manifest.IndexOf("SplashScreen");
				manifest = manifest.Substring(idx);
				idx = manifest.IndexOf("BackgroundColor");
				if (idx < 0)  // background is optional
					return;
				manifest = manifest.Substring(idx);
				idx = manifest.IndexOf("\"");
				manifest = manifest.Substring(idx + 2); // also remove quote and # char after it
				idx = manifest.IndexOf("\"");
				manifest = manifest.Substring(0, idx);
				int value = Convert.ToInt32(manifest, 16) & 0x00FFFFFF;
				byte r = (byte)(value >> 16);
				byte g = (byte)((value & 0x0000FF00) >> 8);
				byte b = (byte)(value & 0x000000FF);

				await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.High, delegate()
					{
						ExtendedSplashGrid.Background = new SolidColorBrush(Color.FromArgb(0xFF, r, g, b));
					});
			}
			catch (Exception)
			{ }
		}

		public SwapChainPanel GetSwapChainPanel()
		{
			return DXSwapChainPanel;
		}

		public void RemoveSplashScreen()
		{
			DXSwapChainPanel.Children.Remove(ExtendedSplashGrid);
			if (onResizeHandler != null)
			{
				Window.Current.SizeChanged -= onResizeHandler;
				onResizeHandler = null;
			}
		}

#if !UNITY_WP_8_1
		protected override Windows.UI.Xaml.Automation.Peers.AutomationPeer OnCreateAutomationPeer()
		{
			return new UnityPlayer.XamlPageAutomationPeer(this);
		}
#else
		// This is the default setup to show location consent message box to the user
		// You can customize it to your needs, but do not remove it completely if your application
		// uses location services, as it is a requirement in Windows Store certification process
		private async void SetupLocationService()
		{
			AppCallbacks appCallbacks = AppCallbacks.Instance;
			if (!appCallbacks.IsLocationCapabilitySet())
			{
				return;
			}

			const string settingName = "LocationContent";
			bool userGaveConsent = false;

			object consent;
			var settings = Windows.Storage.ApplicationData.Current.LocalSettings;
			var userWasAskedBefore = settings.Values.TryGetValue(settingName, out consent);

			if (!userWasAskedBefore)
			{
				var messageDialog = new Windows.UI.Popups.MessageDialog("Can this application use your location?", "Location services");

				var acceptCommand = new Windows.UI.Popups.UICommand("Yes");
				var declineCommand = new Windows.UI.Popups.UICommand("No");

				messageDialog.Commands.Add(acceptCommand);
				messageDialog.Commands.Add(declineCommand);

				userGaveConsent = (await messageDialog.ShowAsync()) == acceptCommand;
				settings.Values.Add(settingName, userGaveConsent);
			}
			else
			{
				userGaveConsent = (bool)consent;
			}

			if (userGaveConsent)
			{	// Must be called from UI thread
				appCallbacks.SetupGeolocator();
			}
		}
#endif
	}
}
Thanks i didn't know that about the mouse input for windows store build sorry !

Is there a way to have mouse input for windows store build, it's strange !!!
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Windows Store Build

31 Aug 2015, 19:45

After you click the Build button, does the message "Failed to patch file" appears in the Unity console?

It is weird because the file we want to patch seems to be in your project: MainPage.xaml.cs, and the code we are looking for is also there: "appCallbacks.SetBridge(_bridge);"
 
picpic2006
Topic Author
Posts: 71
Joined: 07 Nov 2013, 15:59

Re: Windows Store Build

31 Aug 2015, 20:43

yes the message appear in unity console !

I have to write this line to manage it in VS
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Windows Store Build

03 Sep 2015, 18:11

Could you please create a ticket in the bugtracker and attach your project so we can analyze what is happening, because we don't understand why the Postprocessor can't patch the file automatically.

Thanks for your collaboration.
 
picpic2006
Topic Author
Posts: 71
Joined: 07 Nov 2013, 15:59

Re: Windows Store Build

05 Sep 2015, 10:20

Hello,

My first problem is this error appear in my vs studio project can i ignore it
NullReferenceException: Object reference not set to an instance of an object.
   at Noesis.Extend.<GetPublicProperties>b__43e(PropertyInfo p)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Noesis.Extend.GetPublicProperties(Type type)
   at Noesis.Extend.GetPropertyIndex(IntPtr unityType, String propName) 
(Filename: <Unknown> Line: 0)
I have on more problem maybe it is not noesis problem but i tried every thing i imagine with out succes.
My caracter encoding is wrong when i create the package in VS or when i run it via simulator.

All my accent are replaced by ? i know that is due to format encoding character but i tried to convert my files without succes. I desktop or editor all is good.

I have to save MainPage.xaml.cs manually to patch it can it be the problem ?

Can you see a solution

Thanks you
 
picpic2006
Topic Author
Posts: 71
Joined: 07 Nov 2013, 15:59

Re: Windows Store Build

06 Sep 2015, 01:00

hi
i created a ticket and i give you the project by link

thanks

The project is just a test exemple just with Noesis as plugin
[LINK REMOVED]

Who is online

Users browsing this forum: Bing [Bot] and 11 guests