Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        ArSession.SetActive(false);
        if (PlayerPrefs.HasKey("username"))
        {
            StartCoroutine(setImage(PlayerPrefs.GetString("profileimg"), ProfileImage));


            LoginPanal.SetActive(false);
            DashBoardPanel.SetActive(true);
            ProjectsPanal.SetActive(false);
            LoadingPanal.SetActive(false);
            UserName.text        = PlayerPrefs.GetString("displayname");
            UserDescription.text = PlayerPrefs.GetString("description");
        }
        else if (PlayerPrefs.HasKey("intro"))
        {
            LoginPanal.SetActive(true);
            DashBoardPanel.SetActive(false);
            ProjectsPanal.SetActive(false);
            LoadingPanal.SetActive(false);
        }
        else
        {
            LoginPanal.SetActive(false);
            DashBoardPanel.SetActive(false);
            ProjectsPanal.SetActive(false);
            LoadingPanal.SetActive(false);
        }
    }
Exemplo n.º 2
0
    IEnumerator LoadObject(string path, string viewer)
    {
        AssetBundleCreateRequest bundle = AssetBundle.LoadFromFileAsync(path);

        yield return(bundle);

        AssetBundle myLoadedAssetBundle = bundle.assetBundle;

        if (myLoadedAssetBundle == null)
        {
            Debug.Log("Failed to load AssetBundle!");
            yield break;
        }

        var names = myLoadedAssetBundle.GetAllAssetNames();
        //  AssetBundleRequest request = myLoadedAssetBundle.LoadAsset();
        //yield return request;

        AssetBundleRequest objreq = myLoadedAssetBundle.LoadAssetAsync(names[0]);

        yield return(objreq);

        //obj.transform.position = new Vector3(0.08f, -2.345f, 297.54f);
        // obj.transform.Rotate(350.41f, 400f, 20f);
        // obj.transform.localScale = new Vector3(1.0518f, 0.998f, 1.1793f);

        if (viewer.Equals("model"))
        {
            LoadedModel = Instantiate((GameObject)objreq.asset, Model.transform);
            LoadedModel.transform.parent = Model.transform;
            LoadingPanal.SetActive(false);
            ProjectsPanal.SetActive(false);
            ModelPanel.SetActive(true);
            ModelView.SetActive(true);
        }
        else
        {
            if (PlaceOnPlane.AssatObj != null)
            {
                PlaceOnPlane.AssatObj = null;
            }
            PlaceOnPlane.AssatObj            = (GameObject)objreq.asset;
            Projects[projectIndex].LoadedObj = (GameObject)objreq.asset;
            Projects[projectIndex].isloaded  = true;
            LoadingPanal.SetActive(false);
            // ARCanvas.SetActive(true);
            ArSession.SetActive(true);
            ArModePanel.SetActive(true);
            ProjectsPanal.SetActive(false);
            ArExitpanel.SetActive(true);
        }
        myLoadedAssetBundle.Unload(false);
    }