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 G-Force Media · Jun 19, 2015 at 04:15 PM · c#import

OpenFilePanel, but how? - SOLVED!

Hi everyone, I am working on a big project, but at the moment I just want to know how to use "OpenFilePanel". I want to open a movie file. In the Scripting API there was an example, but it didn't work. And there are no tutorials about this. So, if you know how this works, just answer my question.

Looking forward to good answers, :D
G-Force Media

Comment
Add comment · Show 2
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 G-Force Media · Jun 19, 2015 at 05:20 PM 0
Share

I just try to open a file in the program to use it then like a prefab

avatar image meat5000 ♦ · Jun 23, 2015 at 02:38 PM 0
Share

"-1 ANSWERS BUG" Apparent here.

$$anonymous$$ODERATORS - Do not convert comments to answers that were submitted using anything but the "VISIBLE TO EVERYONE" option. Otherwise the answer disappears to the ether.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Jessespike · Jun 19, 2015 at 05:17 PM

What do you mean it doesn't work? Are you getting an error?

The example does indeed work. The script needs to be placed in a folder named "Editor" as mentioned here and here.

Comment
Add comment · Show 5 · 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 G-Force Media · Jun 21, 2015 at 10:56 AM 0
Share

Thanks for your answer, but it doesn't seem better. I get the same error. $$anonymous$$aybe I'm just too "noob" to understand the problem.

Here are some screenshots:

Script: http://answers.unity3d.com/storage/attachments/48516-openfile.png

Errors: http://answers.unity3d.com/storage/attachments/48518-openfile3.png

openfile3.png (17.0 kB)
openfile.png (28.0 kB)
avatar image G-Force Media · Jun 21, 2015 at 11:09 AM 0
Share

Thanks for answering, but it doesn't work even with the Editor folder. Oh, and I want to import the file in the program to use it then like a prefab. I think I'm just too dumb to understand the problem. o_O

Here are some screenshots:

$$anonymous$$y Script Errors

openfile.png (28.0 kB)
openfile3.png (17.0 kB)
avatar image Graham-Dunnett ♦♦ · Jun 21, 2015 at 11:10 AM 0
Share

Line 8 is where the error is reported. The final m in $$anonymous$$enuItem isn't coloured correctly, so I wonder if the $$anonymous$$enuItem has a hidden character.

avatar image Jessespike · Jun 22, 2015 at 05:01 PM 0
Share

The example is written in javascript, but you're using it like C#. Here's the example converted to C#

 using UnityEditor;
 using UnityEngine;
 using System.Collections;
 
 public class EditorUtilityOpenFilePanel : ScriptableObject {
 
     [$$anonymous$$enuItem("Examples/Overwrite Texture")]
     static void Apply () {
     Texture2D texture = (Texture2D) Selection.activeObject;
         if (texture == null) {
             EditorUtility.DisplayDialog(
                 "Select Texture",
                 "You $$anonymous$$ust Select a Texture first!",
                 "Ok");
             return;
         }
         string path = EditorUtility.OpenFilePanel(
             "Overwrite with png",
             "",
             "png");
         if (path.Length != 0) {
             WWW www = new WWW("file:///" + path);
             www.LoadImageIntoTexture(texture);
         }
     }
 }
avatar image G-Force Media · Jun 23, 2015 at 02:31 PM 0
Share

Oops... But, you know, everybody makes mistakes. ^_^ Thanks for your answer and the conversion!

Aaaannnnnnd... SOLVED!

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Burgzergarcade Why am i getting an error after re-importing? 1 Answer

DLL Import => Build finish without Error but Can't Work 0 Answers

[c#] DirectSound in Unity 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