# How to import .obj file from server without using asset bundle in unity3d

I want to import .obj file from a server on run time in unity3D, read lot of questions/answers but not able to find a suitable solution. Using WWW in unity I am able to get .png file and store it in local repository but this thing not works for .obj file. Following is the code I used to get image from server

public string url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg";
IEnumerator Start() {
WWW www = new WWW(url);

while (!www.isDone)
yield return www;

if (www.isDone)
Debug.LogError ("Done");

File.WriteAllBytes("C:\\Users\\Admin\\Downloads\\conan\\test1.jpg", www.bytes);
}


ans similarly I tried to get .obj file but it not works test .obj file created but without any data

public string url = "https://drive.google.com/open?id=0B5_UUyYa_2XdZUpuNlE4Z3pqWUk";
IEnumerator Start() {
WWW www = new WWW(url);

while (!www.isDone)
yield return www;

if (www.isDone)
Debug.LogError ("Done");

File.WriteAllBytes("C:\\Users\\Admin\\Downloads\\conan\\test.obj", www.bytes);
}


Kindly give me help in this regard.

• You're trying to access a drive.google.com link, which doesn't include the file itself but a page that gets loaded and a download button that probably works with javascript to never let you actually see the direct access link of the file. Try accessing the file from an address that actually includes the file. (www.example.com/objfilethatyouhosted.obj or C:\objfile.obj) – John Hamilton Mar 17 '17 at 9:21
• If you don't have access to a hosted server, you can test it on your own machine by setting up a local server. You can use tools like WampServer. – Vaillancourt Mar 20 '17 at 18:01

## 1 Answer

I agree with the drive link comment. Google Drive does not allow for direct file access. Maybe try uploading your obj file to a server and then d9wnload it using www in unity. Should work.