• 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
Question by MSDev002 · Jul 23, 2015 at 12:50 PM · scripting problemplugindll

Using scripting #if define symbols in DLLs

Hi,

I created a new Debug DLL and imported it into the Plugins folder. Everything works fine except that scripting define symbols which are defined in Unity aren't picked up inside the DLL. The DLL code contains this:

 public static class Debug
 {
     public static void Check()
     {
 #if !DEBUG_OUTPUT_OFF
         UnityEngine.Debug.Log("Debug output is ON");
 #else
         UnityEngine.Debug.Log("Debug output is OFF");
 #endif
     }
 }

In Unity, I've set DEBUG_OUTPUT_OFF for the current build platform, but calling this:

         Debug.Check();
 
 #if DEBUG_OUTPUT_OFF
         Debug.Log("Output seems to be off in Unity");
 #endif

...produces this output:

 Debug output is ON
 
 Output seems to be off in Unity

So is there a way to make Unity's scripting define symbols available to DLL code?

Comment

People who like this

0 Show 1
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 meat5000 · Jul 23, 2015 at 12:55 PM 0
Share

Seems you need to enable debug. Place your player in Development mode in Build Settings, then enable Script debugging.

Or are you saying you have already done this and its not working?

How do you know its a problem with symbols?

1 Reply

  • Sort: 
avatar image

Answer by Dave-Carlile · Jul 23, 2015 at 12:53 PM

The defines are compile time things. Once you compile your code, they don't exist, and the code that they filter out doesn't exist.

Your plugin dlls are already compiled outside of Unity. That means they don't and can't know anything about compile conditions you've set up.

What are you trying to do?

Comment
MSDev002
Eric5h5

People who like this

2 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 MSDev002 · Jul 23, 2015 at 05:26 PM 0
Share

I'm trying to make the DLL code sensitive to a define symbol defined in Unity. I'm sure that in a previous project, exactly this kind of setup worked, with some small additions. I guess I need to rebuild the DLL with the same symbols every time I Build&Run through Unity? Maybe by adding something to the build postprocess? Or preprocess?

avatar image Dave-Carlile · Jul 26, 2015 at 01:46 AM 0
Share

Yes you would need to rebuild the dll. I know you can something post process with Unity, but I'm not sure about pre-process.

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

TypeLoadException trying to use FJCore (FluxJpeg) 1 Answer

Dll chaining 0 Answers

Edit asset DLL? 1 Answer

Unity 5 Managed DLL considered Native 0 Answers

Ignore plugin dll when building webplayer version 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