Search Unity

ObjReader - load .obj files at runtime

Discussion in 'Assets and Asset Store' started by Eric5h5, May 7, 2013.

  1. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Try making objData local to the ImportNow function so it's newly created each time; seems like maybe an issue with getting references mixed up.

    --Eric
     
  2. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    Thanks Eric, that fixed it :)
     
  3. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    Hi Eric,

    My problem statement requires that I load .obj files from the local disk, which I can clearly see is possible using ObjReader.
    However, all these .obj files have vertices more than 65000. Do you suggest a way to solve this issue, as I know the ObjReader does not support greater sizes?

    But I really need to be able to replace data from local disk during runtime. All the data file (i.e. .obj files) are of size more than 65000.

    -Akanksha
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The only way to solve that is to make sure the object is divided into sections, where each section is <65K vertices.

    --Eric
     
  5. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    Do you mean, I would have to divide each file into different sections similar to the way Unity Editor loads it?
    But ObjReader will have just one input file right? Or for each section, I will have to create a separate .obj File.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Multiple groups in one .obj file.

    --Eric
     
  7. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    I'm sorry but I am new to this so I ask:
    How do you create multiple groups in one .obj file?
    Also can I use any tool to do this grouping as I have more than 80,000 such files?
    A part of the file looks like this:
    # OBJ File Generated by Meshlab
    #
    ####
    # Object Vol_22_34_22.obj
    #
    # Vertices: 264364
    # Faces: 523893
    #
    ####
    vn -1.672559 0.512008 0.955748
    v 1.000000 1.000000 0.678571
    vn -0.670023 0.478588 0.546958
    v 0.000000 0.142857 0.000000
    vn -0.918604 0.656145 0.749881
    v 0.612245 1.000000 0.000000
    vn -0.464216 0.633022 0.301439
    v 1.000000 0.400000 1.000000
    vn -0.683375 2.174375 0.621250
    v 0.000000 0.000000 0.500000
    vn -0.385904 0.521220 1.262958
    v 2.000000 0.961538 1.000000
    vn -0.152456 0.233167 0.564983
    v 2.058824 1.000000 1.000000
    vn 0.313464 -0.341960 -0.693420
    v 9.090909 0.000000 0.000000
    vn 0.345567 -0.376983 -0.764437
    v 10.000000 0.833333 0.000000
    vn 0.521355 -0.568751 -1.153300
    v 10.000000 0.000000 0.410959
    vn 0.339313 -0.214302 -0.434557
    v 10.105263 1.000000 0.000000
    vn 0.522716 -0.392979 -1.309929
    v 11.000000 0.000000 0.810000
    vn 0.540722 -0.630841 -2.253007
    v 11.791667 0.000000 1.000000
    vn 0.197458 -0.230368 -0.839196
    v 12.000000 0.178571 1.000000
    vn 0.163546 -0.190803 -0.695068
    v 12.958333 1.000000 1.000000
    vn -0.718294 -0.220890 0.718296
    v 143.421051 1.000000 0.000000
    vn -0.983473 -0.188033 1.404965
    v 143.612244 0.000000 0.000000
    vn 0.304184 -0.543356 1.352426
    v 145.000000 0.000000 0.046512
    vn 0.097337 -0.229070 0.744898
    v 144.000000 0.000000 0.271429
    vn 0.414933 -0.098035 0.267407
    v 145.052628 0.000000 0.000000
    vn 0.039364 -0.017894 0.044540
    v 145.000000 1.000000 0.448276
    vn 0.042065 -0.697080 1.194994
    v 202.000000 0.821429 0.000000
    vn 0.006213 -0.102961 0.176505
    v 203.000000 1.000000 0.068966
    vn 0.522134 -0.770828 0.721097
    v 203.000000 0.935484 0.000000
    vn 0.370569 -0.547073 0.511778
    v 203.095245 1.000000 0.000000
    vn -0.353381 0.387037 0.235588
    v 1.642857 2.000000 0.000000
    vn -1.186315 1.299298 0.790877
    v 1.000000 1.413043 0.000000
    vn -0.006083 0.013240 0.022544
    v 3.000000 1.432432 1.000000
    vn -0.071807 0.152305 0.374587
    v 2.000000 1.000000 0.984127
    vn -0.301921 0.301921 0.742564
    v 3.567568 2.000000 1.000000
    vn 0.402628 -0.322966 -0.706366
    v 10.907408 2.000000 0.000000
    vn 0.584792 -0.469088 -1.025952
    v 11.000000 1.000000 0.510000
    vn 0.181041 -0.165956 -0.769424
    v 13.000000 1.045455 1.000000
    vn 0.010150 -0.009304 -0.043137
    v 12.000000 1.000000 0.774510
    vn 0.186161 -0.163821 -0.834000
    v 13.840000 2.000000 1.000000
    vn -0.366822 -0.154452 0.366823
    v 144.000000 2.000000 1.000000
    vn -1.337437 -0.028163 0.802470
    v 143.399994 2.000000 0.000000
    vn 0.193831 -0.624565 1.483343
    v 144.000000 1.000000 0.578947
    vn 1.050776 -1.050782 0.926249
    v 145.000000 1.592593 1.000000
    vn 0.246555 -0.246556 0.217336
    v 145.288895 1.000000 0.000000
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It depends on the 3D app used to make the .obj files. For example, in Blender, having separate objects makes each one be a separate group when exported to .obj. If objects are all combined then it's one group.

    --Eric
     
  9. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    I already have these big .obj files created, each with more than 65000 vertices. I don't know if I can now split it using blender.

    Also, Is there a way that the file can be directly bypassed to the unity editor so that the editor can take care of the splitting as it usually does?

    As I see from the ObjReader design, its the Object Manager that checks for the maximum limit of vertices. Can that be bypassed?

    Can we use this ObjReader to read the pathname of the .obj file and load it to the scene during runtime and then the Unity Editor can take care of the data splitting as usual.

    Sorry, I am just looking for solutions that is feasible as I am running out of time to finish this task.

    -Akanksha
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If you load .obj files in the Unity editor, then it's not going through ObjReader and there is no way to access any Unity editor mesh splitting from scripts. The limit per mesh can't be bypassed because it's a hard limit in Unity, that's why the limit exists in ObjReader. Unfortunately there isn't any solution to reading files with ObjReader that doesn't involve having the .obj files be made with groups that are <65K vertices.

    --Eric
     
  11. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    OK. I guess then I will stick to this solution that I try to create .obj files with groups and then use ObjReader to load them.
    However, I tried using ObjReader using a very small .obj file with 15 vertices, but it fails to load it. I am following a similar code as Example 3.

    When I click a button only then I want this Obj file to be loaded, so I use the following two lines of code in my button's event handler:
    objFileName = Application.dataPath + "/ObjReader/Sample Files/testData/cube.obj";
    ObjReader.use.ConvertFile (objFileName, false, standardMaterial, transparentMaterial);

    But this doesn't work. It gives me NullReferenceException when I click the button.

    Is there any user manual for ObjReader? Where we can read about the arguments passed to the function.
     
    Last edited: Mar 13, 2017
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, the documentation is included, and is labeled as such. A null reference exception means you're trying to use an object that doesn't exist, which could be the materials. You can use basic debugging like printing out variables to see what's null.

    --Eric
     
  13. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    I printed the ObjFileName, standardMaterial and transparentMaterial. All three arguments gives me the following values:
    • C:/Users/Public/Documents/Unity Projects/Controllers/Assets/ObjReader/Sample Files/testData/cube.obj
    • Standard (UnityEngine.Material)
    • Transparent (UnityEngine.Material)
    The Materials are provided from the ObjReader resource folder in the same way as done in the Example 3.

    But it still gives me the null reference exception which says:
    "NullReferenceException: Object reference not set to an instance of an object"

    --Akanksha
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    What line is it referring to? Are there other errors before that one?

    --Eric
     
  15. aashwini

    aashwini

    Joined:
    Oct 9, 2015
    Posts:
    2
    It refers to the second line and there is no previous error:
    ObjReader.use.ConvertFileName(ObjFileName, false, standardMaterial, TransparentMaterial);
     
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Can you post the .obj file?

    --Eric
     
  17. aashwini

    aashwini

    Joined:
    Oct 9, 2015
    Posts:
    2
    # cube.obj
    #

    g cube

    v 0.0 0.0 0.0
    v 0.0 0.0 1.0
    v 0.0 1.0 0.0
    v 0.0 1.0 1.0
    v 1.0 0.0 0.0
    v 1.0 0.0 1.0
    v 1.0 1.0 0.0
    v 1.0 1.0 1.0

    vn 0.0 0.0 1.0
    vn 0.0 0.0 -1.0
    vn 0.0 1.0 0.0
    vn 0.0 -1.0 0.0
    vn 1.0 0.0 0.0
    vn -1.0 0.0 0.0

    f 1//2 7//2 5//2
    f 1//2 3//2 7//2
    f 1//6 4//6 3//6
    f 1//6 2//6 4//6
    f 3//3 8//3 7//3
    f 3//3 4//3 8//3
    f 5//5 7//5 8//5
    f 5//5 8//5 6//5
    f 1//4 5//4 6//4
    f 1//4 6//4 2//4
    f 2//1 6//1 8//1
    f 2//1 8//1 4//1
     
  18. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I tried that file with the Example3-ExternalFile script and it works fine.

    --Eric
     
  19. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    I don't suppose you ever have any plans to be able to automatically split meshes > 65k vertices into seperate submeshes?

    One or two other plugins do support this, but are exceptionally slow

    We are making a 3d modelling application and it is not desirable to force users to export models in a specific way

    If not, do you have any advise on how to edit the source code to do it? or would you consider it impossible?
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I don't have any current plans, sorry. Perhaps splitting the meshes is the cause of the slowness?

    --Eric
     
  21. tomas-dostal

    tomas-dostal

    Joined:
    Jul 13, 2015
    Posts:
    3
    Dear Eric,

    How can I fix faults with importing textures, including transparent and normal material in one model? The yellow window in the following screenshot is another 3D viewer program with the same file.
    I am using the example scene 2.
    Screenshot from 2017-03-28 14-01-01.png

    MTL:
    Code (mtl):
    1.  
    2. # wavefront mtl file written by the visualization toolkit
    3.  
    4. newmtl mtl1
    5. Ka 0 0 0
    6. Kd 0 0 0
    7. Ks 0 0 0
    8. Ns 1
    9. Tr 1 illum 3
    10.  
    11. newmtl mtl9
    12. Ka 1 1 1
    13. Kd 1 0.49 0.25
    14. Ks 1 1 1
    15. Ns 20
    16. Tr 0.5 illum 3
    17.  
    18. newmtl mtl31061
    19. Ka 1 1 1
    20. Kd 1 1 0.9412
    21. Ks 1 1 1
    22. Ns 1
    23. Tr 1 illum 3
    and it should look like this: MedicalApp-tester.png


    Thank you,
    Tomas Dostal
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I see you have some errors in the console; first step is to resolve those so the model is completely imported, since right now it's missing sections.

    --Eric
     
  23. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    Hi Eric,

    As per our last conversation, you mentioned that for using files with vertices greater than 65000 we need to make one .obj file with multiple groups.
    I made this simple .obj structure file in blender with two mesh parts. But I couldn't load it properly in Unity using the ObjReader.

    I used the following files in example 3 and only Mesh Part 1 gets loaded:
    ********************************************************************************************************
    .obj file
    ********************************************************************************************************
    # Blender v2.77 (sub 0) OBJ File: 'test__mesh_multiple_parts_to_obj_groups.blend'
    # www.blender.org
    mtllib test__mesh_multiple_parts_to_obj_groups.mtl
    g Mesh_Part_1
    v 1.000000 -1.000000 -1.000000
    v 1.000000 -1.000000 1.000000
    v -1.000000 -1.000000 1.000000
    v -1.000000 -1.000000 -1.000000
    v 1.000000 1.000000 -0.999999
    v 0.999999 1.000000 1.000001
    v -1.000000 1.000000 1.000000
    v -1.000000 1.000000 -1.000000
    vn 0.0000 -1.0000 0.0000
    vn 0.0000 1.0000 0.0000
    vn 0.0000 -0.0000 1.0000
    vn -1.0000 -0.0000 -0.0000
    vn 0.0000 0.0000 -1.0000
    usemtl (null)
    s off
    f 2//1 4//1 1//1
    f 8//2 6//2 5//2
    f 6//3 3//3 2//3
    f 3//4 8//4 4//4
    f 1//5 8//5 5//5
    f 2//1 3//1 4//1
    f 8//2 7//2 6//2
    f 6//3 7//3 3//3
    f 3//4 7//4 8//4
    f 1//5 4//5 8//5
    g Mesh_Part_2
    v 3.000000 -1.000000 -1.000000
    v 3.000000 -1.000000 1.000000
    v 1.000000 -1.000000 1.000000
    v 1.000000 -1.000000 -1.000000
    v 3.000000 1.000000 -0.999999
    v 2.999999 1.000000 1.000001
    v 1.000000 1.000000 1.000000
    v 1.000000 1.000000 -1.000000
    vn 0.0000 -1.0000 0.0000
    vn 0.0000 1.0000 0.0000
    vn 1.0000 -0.0000 0.0000
    vn 0.0000 -0.0000 1.0000
    vn 0.0000 0.0000 -1.0000
    usemtl (null)
    s off
    f 10//6 12//6 9//6
    f 16//7 14//7 13//7
    f 13//8 10//8 9//8
    f 14//9 11//9 10//9
    f 9//10 16//10 13//10
    f 10//6 11//6 12//6
    f 16//7 15//7 14//7
    f 13//8 14//8 10//8
    f 14//9 15//9 11//9
    f 9//10 12//10 16//10
    *******************************************************************************************************

    .mtl File
    *******************************************************************************************************
    # Blender MTL File: 'test__mesh_multiple_parts_to_obj_groups.blend'
    # Material Count: 0
    *******************************************************************************************************
    Kindly let me know if you are able to use it and how?
    Also, I had a conceptual question: Do I need to use IEnumerator to load structures?
    I have a UI button which when pressed only then a structure needs to be loaded and then needs to get replaced when some button is pressed. Kindly guide me through this?

    --Akanksha
     
  24. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I assume you have "combine multiple groups" checked. You need to use a coroutine to load via WWW, otherwise not. See the example scripts for details of usage.

    --Eric
     
  25. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    Thanks! Yes, the "combine Multiple Groups" was checked.

    However, I still don't a clarity on the other part of the question.

    Also, will multiple groups each of 65000 vertices also work? I ask this because the max points set is 65000.
    Do I need to change that in order to load an Obj file with more than 65000 vertices having multiple groups of each containing 65000 vertices?

    I am still trying to create such obj files, though. But, I am just asking to make sure after all the effort, ObjReader will work, or not?

    -Akanksha
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    As long as each group is <65K vertices it's fine. There's no limit to the number of groups, since each one is a separate mesh.

    --Eric
     
  27. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    Ok, Thanks, Eric!
    Also, all the meshes will be displayed as a combined single model, right? Or it shows only 65000 vertices at a time?
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Neither of those...not combined, since each mesh is limited to <65K vertices, but it shows them all using as many meshes as needed.

    --Eric
     
  29. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    Hi Eric,

    I created an Obj file having 8 groups and each having a limit of 65000 vertices using blender. I tried putting the file in Example 3 and it worked fine!!! :) Thanks!!!

    However, Now when I put it in my code. It throws an error! In my scene, I have a canvas where I have a button as a child gameobject. Now I connect the ObjReader script to this button and also my script where the button's event handler calls the .obj file.

    It throws an error that "DontDestroyonLoad() works only for root gameobjects" But I have to organize these buttons on the canvas. What shall I do? I have 6 such buttons on the canvas and all of them have objReader script as an attached component.

    --Akanksha
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    ObjReader should be on one object only; there's no reason to have it on anything other than an empty game object in the scene root, as shown in the demo scenes. The ObjReader functions can be called from anywhere.

    --Eric
     
  31. aashwini005

    aashwini005

    Joined:
    Jan 19, 2017
    Posts:
    14
    Hi Eric,

    Ok! Creating a root empty object worked.

    I have another question: How do you remove objects during runtime using ObjReader?

    --Akanksha
     
  32. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nothing to do with ObjReader; use standard Unity functions (e.g. Destroy).

    --Eric
     
  33. rublb

    rublb

    Joined:
    Apr 15, 2017
    Posts:
    2
    Hi everyone,
    I'm trying to get access the transform settings of the loaded object but can`t. It seems static and won`t react to any script. I'm new in this scene so the answer might to obvious but I can`t figure it out. All other object from the same parent react (e.g. rotate, move) , only the loaded object won`t. I simply want to scale the object at runtime.
    I`m thankful for any advice
     
  34. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The converted objects are just standard GameObjects, nothing special. ConvertFile returns a GameObject[] array, and ConvertFileAsync returns ObjData, which contains ObjData.gameObjects, which is a GameObject[] array. See also the Example2-WWW script for an example of referring to the converted GameObjects.

    --Eric
     
  35. musashi917

    musashi917

    Joined:
    Jan 6, 2013
    Posts:
    19
    Hello Eric,
    Do you plan on adding 65k + vertices support ? There is one other package doing this but I would prefer yours as it seems well optimized.
    Regards
     
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I don't have any plans at the moment, sorry.

    --Eric
     
  37. Vrushank26

    Vrushank26

    Joined:
    Feb 8, 2015
    Posts:
    3
    hi, its amazing thanks .
    i want to do some modification in it. and for that i need help.
    so what i want to do is i want to edit www.js or.cs script.
    in this when i paste link of obj model an then click on import then model have to open in new scene where i set all lighting an environment. so how can i do that?
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hi, that's beyond the scope of this topic. If you have a question specifically about ObjReader functions, I can answer that here, but general Unity programming and usage is best discussed elsewhere. To start with, click the "learn" link at the top of this page, which has a bunch of tutorials about how to do stuff in Unity.

    --Eric
     
  39. Vrushank26

    Vrushank26

    Joined:
    Feb 8, 2015
    Posts:
    3
  40. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Well, the file can't be found. You're using an incorrect file name or path.

    --Eric
     
  41. Titos

    Titos

    Joined:
    Jul 26, 2012
    Posts:
    12
    I've been using ObjReader for a few days now, working well. However, when I moved the obj files from being on a server local to the machine to a remote server it stopped working properly.

    Looking at the www example - the end code in the Load function was never being called (remote server) - so much so that I added something that simply renamed the object to find out where. You'll notice below that I've replaced FocusOnObjects with some code that just sets the name. When using a server local to the machine, this gets called. If the identical .obj is loaded from a remote server, it does not. Note: it doesn't even get there.

    Any idea why?

    Code (CSharp):
    1. IEnumerator Load () {
    2.         loading = true;
    3.         if (objData != null && objData.gameObjects != null) {
    4.             for (var i = 0; i < objData.gameObjects.Length; i++) {
    5.                 Destroy (objData.gameObjects[i]);
    6.             }
    7.         }
    8.      
    9.         objData = ObjReader.use.ConvertFileAsync (objFileName, true, standardMaterial);
    10.         while (!objData.isDone) {
    11.             loadingText = "Loading... " + (objData.progress*100).ToString("f0") + "%";
    12.             if (Input.GetKeyDown (KeyCode.Escape)) {
    13.                 objData.Cancel();
    14.                 loadingText = "Cancelled download";
    15.                 loading = false;
    16.                 yield break;
    17.             }
    18.             yield return null;
    19.         }
    20.         loading = false;
    21.         if (objData == null || objData.gameObjects == null) {
    22.             loadingText = "Error loading file";
    23.             yield return null;
    24.             yield break;
    25.         }
    26.      
    27.         loadingText = "Import completed";
    28.         //FocusOnObjects();
    29.         for (var i = 0; i < objData.gameObjects.Length; i++) {
    30.             objData.gameObjects [i].name = "Something";
    31.         }
    32.     }
    33.  
     
    Last edited: May 18, 2017
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Does it complete loading the object? Maybe it's just taking a while to download? Did you try it with the demo objects on my site (like Spot.obj that's used by default with the Example2-WWW demo)?

    --Eric
     
  43. Titos

    Titos

    Joined:
    Jul 26, 2012
    Posts:
    12
    Ha.. my fault. The loader contain a coroutine, so making the UI it was called from inactive was hanging the coroutine. Model was loading but non of the "afterload" code was being called.

    My bad.
     
  44. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OK, good to know.

    --Eric
     
  45. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Version 2.5 is out:

    ObjReader 2.5

    Fixes:
    • The UseMtlFallback option works for local files.
    • Transparency values are inverted when the mtl file uses "tr" instead of "d".

    --Eric
     
  46. jmkzn

    jmkzn

    Joined:
    May 24, 2017
    Posts:
    5
    Hi Eric, we would like to keep the imported model(s) as components inside scene after exiting play mode, allowing to import multiple models as needed. Would you have any suggestions on how to accomplish this task?

    Jose
     
  47. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hi, wouldn't you just import them directly into Unity in that case? I don't really follow how ObjReader would be involved, since the point of that is to import .obj files at runtime.

    --Eric
     
  48. jmkzn

    jmkzn

    Joined:
    May 24, 2017
    Posts:
    5
    We plan on allowing users to import files during runtime and keep them in the scene without the need to directly access Unity. Any inputs?

    Jose
     
    Last edited: May 25, 2017
  49. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If I'm understanding you correctly, then I'd say you could use an .obj exporter package of some kind after using ObjReader, in order to save the .obj files.

    --Eric
     
  50. jmkzn

    jmkzn

    Joined:
    May 24, 2017
    Posts:
    5
    Sorry I was not clear before. Let me guide you through how we are using ObjReader. We have a scene with a couple models and we want the user to be able to import in runtime new models for testing. I would like the user to be able to exit playmode and return to playmode, and still have the previously imported models available in the scene. How would ObjReader go about doing this?