Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by liortal · Aug 13, 2014 at 11:25 AM · c#editordllassembly

Why does Assembly-CSharp reference UnityEditor.dll

When adding editor scripts to the project, the generated C# project will reference UnityEditor.dll and the Assembly-CSharp.dll (editor code has access to the unity editor and to all "runtime" game code).

I've just realized now that the generated project Assembly-CSharp is automatically set to reference UnityEditor.dll as well.

What is the logic behind this ? runtime code cannot use any editor features. Is this solely for the purpose of running it in the editor ? If so, why not create that code in Editor folders ?

Comment
Add comment · Show 3
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 vexe · Sep 01, 2014 at 04:18 PM 0
Share

Great question. I wondered that too myself. Never looked into it so much though, I think they remove the reference when you build. $$anonymous$$y guess is that they made it available from your runtime assemblies to make things easier on you? - a lot of the times I find it convenient and less of a bother to include some editor code (like Handles for instance) and wrap it up with #if UNITY_EDITOR. $$anonymous$$aybe there are other reasons.

avatar image BMayne · Sep 01, 2014 at 04:28 PM 0
Share

Hey there,

This lets you have a script in a non-Editor folder but still have access to Editor functions. This works just like Vexe was saying if you want Editor functions in runtime, then you can by defining them out. If you forget to do that your project will fail to build when Unity removes the reference. I would also not be surprised if this had to do with internal Unity stuff.

avatar image vexe · Sep 01, 2014 at 04:36 PM 0
Share

I had a lot of occurrences where I wanted to have such a functionality available to my editor classes. i.e. write editor scripts, put them in an Editor folder and be able to access them somehow from runtime scripts just like UnityEditor. Never gave it too much thought nor effort, but it would be nice.

0 Replies

· Add your reply
  • Sort: 

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

23 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

Related Questions

AutoComplete Text in TextField 2 Answers

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

Saving class fields in the Asset 0 Answers

Getting direct dependencies for an asset 1 Answer

The name 'Joystick' does not denote a valid type ('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