Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by dreal · Apr 16, 2011 at 05:15 PM · assetsresourcesfilesexternalvideos

How to load objects from a file outside of unity3d

Hi,

Is their a way to load files (videos, images) from outside of unity3d assets directory?

What i mean is if you program in a text field function and a button to search your directory on your hard drive for videos and images, would they show up dynamically in the standalone application when i try to search for a file? If so, can i get an idea of how this might be done? I know that this can be done on the server side of things, but the client i am working for wants to search for all his files on his hard drive. I know if i try to use resource.load(), it won't work since it has to be within the the unity assets directory.


Ok thank! So can all this be done on the Iphone using xcode?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by AliAzin · Apr 16, 2011 at 05:27 PM

you can use System.IO for searching in directories and you can load video(ogg format) and images(png) using WWW class in unity. The only thing you should do is pass your file path like this :

var url = "file://c:/fridays.jpg"; function Start () { // Start a download of the given URL var www : WWW = new WWW (url);

 // Wait for download to complete
 yield www;

 // assign texture
 renderer.material.mainTexture = www.texture; 

}

see WWW class reference in docs

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dreal · Apr 19, 2011 at 04:50 AM 0
Share

Ok thanks! So can all this be done on the Iphone using xcode?

avatar image AliAzin · Apr 19, 2011 at 05:30 PM 0
Share

I don't have the iphone version, but it should work with iphone too.

avatar image
1
Best Answer

Answer by Uzquiano · Apr 16, 2011 at 06:04 PM

Hi,

For text files I do like this:

private var file : String = ""file://c:/files/file.txt";

var reader : StreamReader = File.OpenText(file);

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dreal · Apr 19, 2011 at 04:46 AM 0
Share

Ok thank! So can all this be done on the Iphone using xcode?

avatar image Uzquiano · Apr 19, 2011 at 08:07 AM 0
Share

Well... I have never develop Unity for iPhone but I think it should work. And about Xcode, it is only a tool, what matter is what you write in there ;)

avatar image
0

Answer by ravi_gohil999 · Jan 24, 2013 at 06:51 AM

You need to use file:///c:/.... to let this file protocol work....3 slashes

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How can I load an custom file from the Assets folder? 2 Answers

Difference between Resources folder Vs normal folder 0 Answers

Why does my Unity project contain tens of thousands of files when the actual game assets is far less? 2 Answers

Include a file to build - and keep it editable 0 Answers

External Resource Folder -- Please Help 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges