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 The Stick · May 05, 2014 at 03:18 AM · editordllgif

Trying to use FreeImage won't work in Editor

I'm using Unity Free for a project (which is going to end up more of a personal tool for a public thing) and I'm trying to get GIFs loaded off the Internet to animate.

I'd tried using a semi-hybridization of the AnimatedGifDrawer and a small snippit I'd found to load images off the Internet and read it directly from memory. It went something like this:

 WWW www = new WWW("http://mspaforums.com/image.php?u=" + id);
 while(!www.isDone) { }
 MemoryStream stream = new MemoryStream(www.bytes);
 var img = Image.FromStream(stream);

...and proceeded from there like the AnimatedGifDrawer recipe. My only problem was that it didn't seem to like that - it threw UnsupportedOperationException's when trying to img.SelectActiveFrame(dim,i) (`dim` is dimension from the recipe) so I instead decided to try using FreeImage. After all, Unity itself uses FreeImage, so it shouldn't be too hard to use it myself, right?

I'd changed the code around a little bit. Instead of using Image.FromStream I used FreeImageBitmap.FromStream and changed the code from the recipe to fit FreeImage's stuff. I've also stuck FreeImage's IsAvailable near the top to make sure it's loaded before trying to use it:

 if(!FreeImage.IsAvailable()) {
     Debug.LogError("FreeImage not available?!?!", this);
     return;
 }

Weird thing is, `IsAvailable` returns false (throwing my error) when it runs in the Editor, but when I try to run it from a built Standalone it returns true. It's already in the executable's folder (since Unity's using it itself), I've tried putting FreeImage.dll in System32 (probably not a smart idea, honestly) as well as making a folder called ExtraPATH, adding that to the PATH variables (probably double-not-smart), and sticking the DLL in that, no dice. Is there something I'm missing to let Unity use FreeImage within the Editor?

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
Best Answer

Answer by The Stick · May 05, 2014 at 04:55 PM

Oh. That's just great.

In order to use a DLL that's supposed to be in the same directory as the Executable (ie FreeImage.dll) you need to stick it in a Plugins folder on the root of your Assets folder.

The only issue is, in order to use the plugin (either just FreeImage or any DLL), you need to use Unity Pro:

 License Error.  This plugin is only supported in Unity Pro!
 
 FreeImageAPI.FreeImage:IsAvailable()
 FreeImageAPI.FreeImage:IsAvailable()
 Avatar:constructor(Int32)
 ...

Lovely. Just lovely.

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

20 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

Related Questions

Cant link PLUGIN.DLL with PLUGIN-EDITOR.DLL 1 Answer

Access game classes from within Editor extension? 1 Answer

How do I ; from inside another script, read an image resource inside a DLL 1 Answer

C# dll "MissingMethodException" - Before first recompile 1 Answer

DLL not found 2 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