Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Assetbundle and load object in unity3d

$
0
0
How can I load object in unity3D using javascript. Actually I needed an assetbundle concept. For this I created a exportResource.js file in editor and cachload.js in script.But the connection throws an error.I just copy exportResource.js file and paste it into editor. I don't know what changes are made to the exportResource.js in editor. my cachload.js file in script is #pragma strict function Start () { var www = WWW.LoadFromCacheOrDownload ("file://C:/wamp/www/object/bee1.unity3d",4); yield www; if (!String.IsNullOrEmpty(www.error)) { Debug.Log (www.error); return; } var myLoadedAssetBundle = www.assetBundle; var asset = myLoadedAssetBundle.mainAsset; } exportResource.js in editor @MenuItem("Assets/Build AssetBundle From Selection - Track dependencies") static function ExportResource () { // Bring up save panel var path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d"); if (path.Length != 0) { // Build the resource file from the active selection. var selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets); BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets); Selection.objects = selection; } @MenuItem("Assets/Build AssetBundle From Selection - No dependency tracking") static function ExportResourceNoTrack () { // Bring up save panel var path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d"); if (path.Length != 0) { // Build the resource file from the active selection. BuildPipeline.BuildAssetBundle(Selection.activeObject, Selection.objects, path); } } error: A file of the same name is already loaded. Why this error occurs? I Referred link here. http://docs.unity3d.com/Documentation/Manual/keepingtrackofloadedassetbundles.html

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>