Search Unity

Loading up an obj at runtime from the oculus quest sd card

Discussion in 'AR/VR (XR) Discussion' started by jeromegold, May 3, 2020.

  1. jeromegold

    jeromegold

    Joined:
    Apr 7, 2020
    Posts:
    47
    Hi,

    I'm using ObjImporter to load up an obj at runtime.
    i've created a sphere prefab and i'm using that as the base for loading up my obj which is a wooden board.

    board = Instantiate(prefab, new Vector3(6, 1, 9), Quaternion.identity) as GameObject;
    ObjImporter newMesh = new ObjImporter();
    Mesh mesh = newMesh.ImportFile(path);
    board.GetComponent<MeshFilter>().mesh = mesh;

    When debugging to the console board is instantiated and its transform.position is correct. But there is nothing to see.

    The sphere prefab that is being used has a meshfilter, meshrenderer, material, rigid body and collision on it.
    Just wanted to swap out the mesh. The sphere mesh seems to be gone but the mesh.obj isn't loaded up.

    And path for the file is /storage/emulated/0/Android/data/com.xxx.xxxx/files/mesh.obj

    After any advice. Thx.
     
    EndritP likes this.
  2. EndritP

    EndritP

    Joined:
    May 10, 2018
    Posts:
    1
    Did you find a solution for this?