Skip to content

Using External Data

mika edited this page May 22, 2018 · 2 revisions

Using External Data

  • void Instantiate(string prefabPath)
    • instantiates pre-made prefab (must be already inside the app Resources/ folder)
  • void Instantiate(string prefabPath, string name)
    • instantiates pre-made prefab (must be already inside the app Resources/ folder)
    • and assigns name to the gameobject
  • void LoadBundle(string bundleURL)
    • loads assetbundle from server url and instantiates to scene
  • void LoadBundle(string bundleURL, string name)
    • loads assetbundle from server url and instantiates to scene and sets name
    • example: b:LoadBundle("https://binoo.edu2vr.com/public/asset-bundle/$PLATFORM$/Fossils%20and%20Skeletons/Dinosaur%20skull","skull")
    • NOTE: $PLATFORM$-string is required to allow different platforms to load their own bundle
    • NOTE: loading is asynchronous, so the object wont be available until loading has finished
  • void CleanBundleCache()
    • clears asset bundle cache (to force loading new version from server)
    • NOTE: in current version cleancache is called on every loadbundle
  • string GetAssetURL(string modelRelativePath)
    • example b:LoadBundle(b:GetAssetURL("Plants%20and%20Animals/Spider_walk"),"1")
    • returns full assetbundle url, with correct platform (android/ios)
  • void LoadStringFromURL(string url, string key = null)
    • load string from url, string is saved to internal 'lastLoadedString'-variable
    • key is optional, if given, loaded text is assigned into internal string dictionary with that key
    • if key is not given, string is loaded into internal lastLoadedString variable
    • in lua script, you can then wait until given key exists, that means data is loaded or use the waitForMe bool
  • void ParseBVHFromLastLoadedString(string targetObj, bool drawDebugOnly = false, bool zIsUp = true)
    • parses BVH mocap data from internal internal 'lastLoadedString'-variable and assigns animation to targetObj
    • Note: Bone names are renamed "hip", "Hips", "abdomen", "lowerBack", "rToe", "RightToes"..and more
    • Note: Z is up is default on
    • Note: drawDebugOnly wont show mesh to the user, because its at 0,0,0
  • void ParseBVHFromString(string targetObj, string key, bool drawDebugOnly = false, bool zIsUp = true)
    • Same as above, but takes string from internal string dictionary, with given string 'key'

Examples

https://github.com/NTUSPMS/BinooAPI/tree/master/ExternalAssets

Clone this wiki locally