• 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 linkrules · Oct 26, 2013 at 07:52 AM · editorimportasset

Write a Editor to select file from disk and import to unity

Hello, I need help ,i want to write a editor to import texture from disk,the function is you press the "Import" button ,it can pop a window to you ,you can select file from disk ,like "Assets -- Import New Assets",but i don't know how to pop the selection window

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by fafase · Oct 26, 2013 at 08:08 AM

Fact is Unity won't let you do that directly. There is this:

http://docs.unity3d.com/Documentation/ScriptReference/EditorUtility.OpenFilePanel.html

which only work in Editor mode meaning you won't be able to put that in a build.

You may think it is exactly what you need and wonder why they would not allowed that in the build, security. I could sell you an application that on the front allows to save and open file from your hard drive, but in the meanwhile, on the back, I am scanning your computer, sending all your personal pictures (even the kinky ones :)) and sending them to my blog.

Now there are solutions though, first if your game is a web player, you can use Javascript, the real one, the web one and make a small method

http://stackoverflow.com/questions/6463439/how-to-open-a-file-browse-dialog-using-javascript

that opens up a file explorer, the method is then called using Application.ExternalCall.

Otherwise there is this: http://wiki.unity3d.com/index.php?title=ImprovedFileBrowser

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Import Unity package / Asset by script with selection 0 Answers

Extending support for other file formats. 1 Answer

How do I make copies of my Font with an editor script? 2 Answers

Getting properties on 'missing' things in Editor Scripts? 4 Answers

How to Massplace Assets with Script at Edittime 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges