can't load gameobject in runtime from datapersistentpath











up vote
0
down vote

favorite












I have A directory in the dataPersistentPath, the name of directory is "FBXFiles".
so the access is:
Path.Combine(Application.persistentDataPath, "FBXFiles");



I want to load all of the files in this directory as GameObjects (or UnityEngine.Object)
One more thing, this application is for hololens, so I can't use the UnityEditor namespace...



How can I do that? I've tried with assetBundle but no luck...how can I do it at runtime...?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I have A directory in the dataPersistentPath, the name of directory is "FBXFiles".
    so the access is:
    Path.Combine(Application.persistentDataPath, "FBXFiles");



    I want to load all of the files in this directory as GameObjects (or UnityEngine.Object)
    One more thing, this application is for hololens, so I can't use the UnityEditor namespace...



    How can I do that? I've tried with assetBundle but no luck...how can I do it at runtime...?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have A directory in the dataPersistentPath, the name of directory is "FBXFiles".
      so the access is:
      Path.Combine(Application.persistentDataPath, "FBXFiles");



      I want to load all of the files in this directory as GameObjects (or UnityEngine.Object)
      One more thing, this application is for hololens, so I can't use the UnityEditor namespace...



      How can I do that? I've tried with assetBundle but no luck...how can I do it at runtime...?










      share|improve this question













      I have A directory in the dataPersistentPath, the name of directory is "FBXFiles".
      so the access is:
      Path.Combine(Application.persistentDataPath, "FBXFiles");



      I want to load all of the files in this directory as GameObjects (or UnityEngine.Object)
      One more thing, this application is for hololens, so I can't use the UnityEditor namespace...



      How can I do that? I've tried with assetBundle but no luck...how can I do it at runtime...?







      c# unity3d hololens






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Nadav

      176




      176
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Unity does not support importing objects as game objects at runtime, since it optimizes them and converts them to game ready assets at build time and in the editor. You can try including a library to load these objects, maybe as something open source like OBJ and create new game objects with materials but I am not sure this will work. Or use asset bundles, but generally System.IO and asset bundles are a bad move. Unity has built in functions for accessing asset bundles.

          Best of luck.






          share|improve this answer





















          • Yeah but how...? Can i create assetbundle and add files into it at runtime?
            – Nadav
            17 hours ago










          • You can try this: answers.unity.com/questions/10868/…. They are making their own asset bundles.
            – CausticLasagne
            13 hours ago










          • OK looks good... I'll try if I won't find another solution (maybe I'll upload asset bundle files that I'll create with unity and that's it)
            – Nadav
            12 hours ago










          • Don't forget to mark the answer. Cheers!
            – CausticLasagne
            8 hours ago


















          up vote
          1
          down vote













          You can't do this



          FBX files are assets that require importing and conversion to Unity's (internal) format. You need to use Asset Bundles.






          share|improve this answer





















          • But how should i use the assetbundles? I want to download fbx files to this directory but not to build again...
            – Nadav
            17 hours ago










          • I haven't used asset bundles yet myself, but "downloading to a directory and not building again" is exactly what they're for.
            – Draco18s
            12 hours ago











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53137187%2fcant-load-gameobject-in-runtime-from-datapersistentpath%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          Unity does not support importing objects as game objects at runtime, since it optimizes them and converts them to game ready assets at build time and in the editor. You can try including a library to load these objects, maybe as something open source like OBJ and create new game objects with materials but I am not sure this will work. Or use asset bundles, but generally System.IO and asset bundles are a bad move. Unity has built in functions for accessing asset bundles.

          Best of luck.






          share|improve this answer





















          • Yeah but how...? Can i create assetbundle and add files into it at runtime?
            – Nadav
            17 hours ago










          • You can try this: answers.unity.com/questions/10868/…. They are making their own asset bundles.
            – CausticLasagne
            13 hours ago










          • OK looks good... I'll try if I won't find another solution (maybe I'll upload asset bundle files that I'll create with unity and that's it)
            – Nadav
            12 hours ago










          • Don't forget to mark the answer. Cheers!
            – CausticLasagne
            8 hours ago















          up vote
          1
          down vote



          accepted










          Unity does not support importing objects as game objects at runtime, since it optimizes them and converts them to game ready assets at build time and in the editor. You can try including a library to load these objects, maybe as something open source like OBJ and create new game objects with materials but I am not sure this will work. Or use asset bundles, but generally System.IO and asset bundles are a bad move. Unity has built in functions for accessing asset bundles.

          Best of luck.






          share|improve this answer





















          • Yeah but how...? Can i create assetbundle and add files into it at runtime?
            – Nadav
            17 hours ago










          • You can try this: answers.unity.com/questions/10868/…. They are making their own asset bundles.
            – CausticLasagne
            13 hours ago










          • OK looks good... I'll try if I won't find another solution (maybe I'll upload asset bundle files that I'll create with unity and that's it)
            – Nadav
            12 hours ago










          • Don't forget to mark the answer. Cheers!
            – CausticLasagne
            8 hours ago













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Unity does not support importing objects as game objects at runtime, since it optimizes them and converts them to game ready assets at build time and in the editor. You can try including a library to load these objects, maybe as something open source like OBJ and create new game objects with materials but I am not sure this will work. Or use asset bundles, but generally System.IO and asset bundles are a bad move. Unity has built in functions for accessing asset bundles.

          Best of luck.






          share|improve this answer












          Unity does not support importing objects as game objects at runtime, since it optimizes them and converts them to game ready assets at build time and in the editor. You can try including a library to load these objects, maybe as something open source like OBJ and create new game objects with materials but I am not sure this will work. Or use asset bundles, but generally System.IO and asset bundles are a bad move. Unity has built in functions for accessing asset bundles.

          Best of luck.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 17 hours ago









          CausticLasagne

          908




          908












          • Yeah but how...? Can i create assetbundle and add files into it at runtime?
            – Nadav
            17 hours ago










          • You can try this: answers.unity.com/questions/10868/…. They are making their own asset bundles.
            – CausticLasagne
            13 hours ago










          • OK looks good... I'll try if I won't find another solution (maybe I'll upload asset bundle files that I'll create with unity and that's it)
            – Nadav
            12 hours ago










          • Don't forget to mark the answer. Cheers!
            – CausticLasagne
            8 hours ago


















          • Yeah but how...? Can i create assetbundle and add files into it at runtime?
            – Nadav
            17 hours ago










          • You can try this: answers.unity.com/questions/10868/…. They are making their own asset bundles.
            – CausticLasagne
            13 hours ago










          • OK looks good... I'll try if I won't find another solution (maybe I'll upload asset bundle files that I'll create with unity and that's it)
            – Nadav
            12 hours ago










          • Don't forget to mark the answer. Cheers!
            – CausticLasagne
            8 hours ago
















          Yeah but how...? Can i create assetbundle and add files into it at runtime?
          – Nadav
          17 hours ago




          Yeah but how...? Can i create assetbundle and add files into it at runtime?
          – Nadav
          17 hours ago












          You can try this: answers.unity.com/questions/10868/…. They are making their own asset bundles.
          – CausticLasagne
          13 hours ago




          You can try this: answers.unity.com/questions/10868/…. They are making their own asset bundles.
          – CausticLasagne
          13 hours ago












          OK looks good... I'll try if I won't find another solution (maybe I'll upload asset bundle files that I'll create with unity and that's it)
          – Nadav
          12 hours ago




          OK looks good... I'll try if I won't find another solution (maybe I'll upload asset bundle files that I'll create with unity and that's it)
          – Nadav
          12 hours ago












          Don't forget to mark the answer. Cheers!
          – CausticLasagne
          8 hours ago




          Don't forget to mark the answer. Cheers!
          – CausticLasagne
          8 hours ago












          up vote
          1
          down vote













          You can't do this



          FBX files are assets that require importing and conversion to Unity's (internal) format. You need to use Asset Bundles.






          share|improve this answer





















          • But how should i use the assetbundles? I want to download fbx files to this directory but not to build again...
            – Nadav
            17 hours ago










          • I haven't used asset bundles yet myself, but "downloading to a directory and not building again" is exactly what they're for.
            – Draco18s
            12 hours ago















          up vote
          1
          down vote













          You can't do this



          FBX files are assets that require importing and conversion to Unity's (internal) format. You need to use Asset Bundles.






          share|improve this answer





















          • But how should i use the assetbundles? I want to download fbx files to this directory but not to build again...
            – Nadav
            17 hours ago










          • I haven't used asset bundles yet myself, but "downloading to a directory and not building again" is exactly what they're for.
            – Draco18s
            12 hours ago













          up vote
          1
          down vote










          up vote
          1
          down vote









          You can't do this



          FBX files are assets that require importing and conversion to Unity's (internal) format. You need to use Asset Bundles.






          share|improve this answer












          You can't do this



          FBX files are assets that require importing and conversion to Unity's (internal) format. You need to use Asset Bundles.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          Draco18s

          9,85531940




          9,85531940












          • But how should i use the assetbundles? I want to download fbx files to this directory but not to build again...
            – Nadav
            17 hours ago










          • I haven't used asset bundles yet myself, but "downloading to a directory and not building again" is exactly what they're for.
            – Draco18s
            12 hours ago


















          • But how should i use the assetbundles? I want to download fbx files to this directory but not to build again...
            – Nadav
            17 hours ago










          • I haven't used asset bundles yet myself, but "downloading to a directory and not building again" is exactly what they're for.
            – Draco18s
            12 hours ago
















          But how should i use the assetbundles? I want to download fbx files to this directory but not to build again...
          – Nadav
          17 hours ago




          But how should i use the assetbundles? I want to download fbx files to this directory but not to build again...
          – Nadav
          17 hours ago












          I haven't used asset bundles yet myself, but "downloading to a directory and not building again" is exactly what they're for.
          – Draco18s
          12 hours ago




          I haven't used asset bundles yet myself, but "downloading to a directory and not building again" is exactly what they're for.
          – Draco18s
          12 hours ago


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53137187%2fcant-load-gameobject-in-runtime-from-datapersistentpath%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()