Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by hollym16 · Sep 19, 2014 at 10:43 AM · androidgameobjectaugmented-realityobb

Extracting Dataset (AR) from OBB (Expansion Files)

Bear with me on this one, its mainly a question about correct coding.

I have an Augmented Reality project that I'm using OBB Expansion Files with. I've got it all working great but the ARCamera doesn't augment anything. I know this requires some coding in order to extract the .XML and .DAT files specified here:

https://developer.vuforia.com/forum/faq/unity-how-can-i-handle-large-android-apps https://developer.vuforia.com/forum/faq/unity-loading-dataset-sd-card https://developer.vuforia.com/forum/android/android-split-issue-unity3d

Based on these 3 links I've come up with this:

First I created a scene with a Main Camera and Empty GameObject in it. On the GameObject I put the following script:

 using UnityEngine;
 using System.Collections;
 using System.IO;
 
 public class ObbExtractor : MonoBehaviour
 {
     private string urlOfDatasetInObb, filePath, directoryPath;
     private IEnumerator loadARComponentsForAPKSplit()
     {
         //if UNITY_ANDROID
         urlOfDatasetInObb = System.String.Empty;
         filePath = directoryPath = System.String.Empty;
         directoryPath = (Application.persistentDataPath + "/QCAR");
         Directory.CreateDirectory (directoryPath);
         yield return null;
         
         urlOfDatasetInObb = (Application.streamingAssetsPath + "/QCAR/TrackerName.xml"); 
         var www = new WWW(urlOfDatasetInObb); 
         yield return www;
         filePath = Path.Combine(directoryPath, "TrackerName.xml");
         File.WriteAllBytes(filePath, www.bytes);
         yield return null;
         
         urlOfDatasetInObb = filePath = System.String.Empty;
         www = null;
         
         urlOfDatasetInObb = (Application.streamingAssetsPath + "/QCAR/TrackerName.dat");
         www = new WWW(urlOfDatasetInObb); 
         yield return www;
         filePath = Path.Combine(directoryPath, "TrackerName.dat");
         File.WriteAllBytes(filePath, www.bytes );
 
         Application.LoadLevel("ARScene");
     }           
     // Can load the level now!
     //endif
     }

Then I created a basic AR scene; tracker and basic model. On the ARCamera, I put the following script:

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 
 public class Extract : MonoBehaviour {
     
     private bool mDataSetsLoaded = false;
     private string[] mDataSetNames = new string[] {"TrackerName.xml", "TrackerName.dat"}; //replace with your dataset name
     // Update is called once per frame
     void Update () 
     {
         ImageTracker itracker = TrackerManager.Instance.GetTracker<ImageTracker>(); 
         if (itracker == null) return;
         if (!mDataSetsLoaded) {
             string dataSetRootDir = Application.persistentDataPath + "/QCAR/";
             foreach(var datasetName in mDataSetNames) {
                 DataSet dataSet = itracker.CreateDataSet();
                 if (dataSet.Load (dataSetRootDir + datasetName, QCARUnity.StorageType.STORAGE_ABSOLUTE))
                     itracker.ActivateDataSet(dataSet);
             }
             mDataSetsLoaded = true;
         }
     }
 }

I then made sure the Dataset is selected and activated, the Write Access is set to External(SDCard) and Split Binary is checked. Whether I test it in Play Mode, or Build and Run it onto my Samsung Galaxy Tab, nothing happens.

Does anyone have a clue what I'm missing?

Thanks in advance

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Wiki

Answer by Hamed_razor · Apr 26, 2015 at 09:25 PM

Thanks Now, how to load the movie on the Android SD Card?

Sorry I'm Not Full English!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

25 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Scripting error message 1 Answer

print out the value (string) of the URL passed to the WWW in the google console 0 Answers

You may not have purchased this app (OBB Expansion Files) 1 Answer

App slow to return to AR scene 0 Answers

Using OBB Expansion Files with Vuforia 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges