• 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 hexdump · Sep 21, 2015 at 05:11 PM · editor-scriptingeditorwindoweditorguieditorguilayout

Drag a non standard unity asset on a custom editor slot

Hi,

I have a .psd file that I want to handle in unity. I'm builidng a little gui window where the player has to drag the file onto it. I guess I should be using ObjectFIeld for that but not sure how to do it. Could anyone give any tip?

Cheers.

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
2

Answer by vintar · Sep 21, 2015 at 07:52 PM

check this, it may help : https://github.com/Banbury/UnityPsdImporter/blob/master/PhotoShopFileType/Editor/PSDEditorWindow.cs

Comment
Add comment · Show 3 · 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 hexdump · Sep 21, 2015 at 09:20 PM 0
Share

I have upvoted your answer and I am really greatefull about the informatio you have provided but this is not answering my question. I mean in the example the coder is expecting a tex2D for the type of the psd file, I think this is not the best way to do that because type doesn't match. Am I missing something?

Waiting for anyone to help with this one.

Cheers.

avatar image Bunny83 hexdump · Sep 22, 2015 at 01:43 AM 0
Share

@hexdump:
If that doesn't answer your question you might be more specific about what you want to do. You said you "want to handle a psd file in unity". When you simply drag a psd file into your project it is automatically imported as Texture2D. If you need some kind of special handling you should be more specific.

The Unity editor is designed to work with assets which are located in the assets folder. The ObjectField can only handle classes which are derived from UnityEngine.Object.

You said you want a GUI window where the user should drag and drop the file. Where does the file come from? If you talk about files which are no assets, so they are located outside of your project's assets folder, that's not possible. For that feature you would need to activate drag and drop support of the OS to make it send "W$$anonymous$$_DROPFILES" messages to your window. Since you don't have access to the editor window message pump, even when you allow drag and drop events you can't receive the data.

The only way around that would be to write a native code plugin which shows a native window which you control yourself.

Anyways, we can't suggest anything without knowing what you want to do.

avatar image hexdump Bunny83 · Sep 22, 2015 at 07:13 AM 0
Share

Ok, my fault. Didn't know .psd files where imported as texture2d :). This clarifies it. Thanks.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

28 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 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

Custom Editor - Is there any way to detect whether the user is in Prefab editing mode? 1 Answer

Positioning a button at the bottom of an editor window 1 Answer

Is it possible to store and display EditorGUILayout.Toggles? 0 Answers

Get position of Rect in Rect in EditorWindow 1 Answer

Editor GUI Foldout header style customization 0 Answers


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