locked
Realtime Obj Importer Build to windows app store issue

    Question

  • hi all :)
    i create a obj importer script , that import obj models in realtime .. inside unity all works fine ..
    but when i build my project to windows app store , the following error comes 

    Tuesday, April 21, 2015 8:22 PM

Answers

  • now it works perfectly :D
    i just get the real url from this function , then i use it inside my OBJ script 

    public  async void ttt()
            {
                var uri = new System.Uri("ms-appx:///Assets/MaleLow.obj");
     
                var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);
                textBox.Text = file.Path;
            }

    if (UnityPlayer.AppCallbacks.Instance.IsInitialized())
    			{
    				UnityPlayer.AppCallbacks.Instance.InvokeOnAppThread(new UnityPlayer.AppCallbackItem(() =>
    				{
                        Communications.SetCubeMaterialColor(r, g, b);
                        
    				}
    				), false);
    			}

    public sealed class Communications
    	{
           
            
            
    		public static void SetCubeMaterialColor(byte r, byte g, byte b)
    		{
    			UnityEngine.GameObject go = UnityEngine.GameObject.Find("Cube");
    			UnityEngine.Material mat = go.GetComponent<XAMLConnection>().material;
    			mat.color = new UnityEngine.Color32(r, g, b, 255);
                UnityEngine.GameObject o = UnityEngine.GameObject.Find("GameObject");
                go.AddComponent<OBJ>().objPath = file.Path;
                
     
    		}

    • Marked as answer by Aymen Tlili Thursday, April 23, 2015 8:25 PM
    Thursday, April 23, 2015 8:24 PM

All replies

  • It's an access denied - maybe ProcMon could help you figure out why it's throwing that.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, April 22, 2015 12:38 PM
    Moderator
  • i think the problem is comming from the script it self , because when i build it to wpf it works fine ..
    inside the script i uses : 

    public string url = "file:///D:/1.jpg";

    IEnumerator Start()
    {
    WWW www = new WWW(url);
    yield return www;
    renderer.material.mainTexture = www.texture;
    }

    i think that the protocol FILE:/// does'nt work in WINRT ..
    so what's the 
    equivalence of it ?

    Wednesday, April 22, 2015 3:48 PM
  • It's true - you can't access a file using the file protocol in WinRT.  You shoud have that file as part of the solution and reference it using the proper protocol from here:

    https://msdn.microsoft.com/en-us/library/windows/apps/hh781215.aspx


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, April 22, 2015 4:00 PM
    Moderator
  • Okey i'll try it now ..
    by the way , i tried to get from a web using HTTP
    this error comes :

    (OBJ.cs is the script that import the files into unity in realtime)

    Wednesday, April 22, 2015 4:50 PM
  • I can't read French. What does it say?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, April 22, 2015 5:33 PM
    Moderator
  • the names of alternative flows are conveyed must begin with "app-"
    Thursday, April 23, 2015 7:07 PM
  • now it works perfectly :D
    i just get the real url from this function , then i use it inside my OBJ script 

    public  async void ttt()
            {
                var uri = new System.Uri("ms-appx:///Assets/MaleLow.obj");
     
                var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);
                textBox.Text = file.Path;
            }

    if (UnityPlayer.AppCallbacks.Instance.IsInitialized())
    			{
    				UnityPlayer.AppCallbacks.Instance.InvokeOnAppThread(new UnityPlayer.AppCallbackItem(() =>
    				{
                        Communications.SetCubeMaterialColor(r, g, b);
                        
    				}
    				), false);
    			}

    public sealed class Communications
    	{
           
            
            
    		public static void SetCubeMaterialColor(byte r, byte g, byte b)
    		{
    			UnityEngine.GameObject go = UnityEngine.GameObject.Find("Cube");
    			UnityEngine.Material mat = go.GetComponent<XAMLConnection>().material;
    			mat.color = new UnityEngine.Color32(r, g, b, 255);
                UnityEngine.GameObject o = UnityEngine.GameObject.Find("GameObject");
                go.AddComponent<OBJ>().objPath = file.Path;
                
     
    		}

    • Marked as answer by Aymen Tlili Thursday, April 23, 2015 8:25 PM
    Thursday, April 23, 2015 8:24 PM