Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Jiraiyah · Oct 09, 2015 at 04:05 PM · c#editorassetdatabasehidefolder

Using Hidden folders for editor stuff?

Hi I would have two scriptable objects one will be used on runtime but the other one that is related to the first one, will have stuff only related to custom editor windows, so i would like to have an Editor folder under a Database folder, the thing is that i would like to hide this editor folder from users both on windows explorer and the project view in unity (I know they can show hidden folders but that is the best i can do am i not?) why would i like to do it? to prevent users from fiddling with the scriptable objects inside the editor folder (that can cause breaking on the system) so I thought this would be used :

 DirectoryInfo info = new DirectoryInfo(editorPath);
 info.Attributes |= FileAttributes.Hidden;

At the same time i made a folder under assets directory and manually set it to hidden and launched unity, well, the folder didn't load in the project view, that is excellent, but now i have one question, will assets database load access this hidden folder? can i use such a hidden folder within code or will it fail? unfortunately, for few days i won't have access to the code at run time to see if it will work or not because i am doing massive refactoring, and that is why i am asking it, because if it won't work, i need to come up with another solution :/ (although i think i won't find any other solution at all)

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

Answer by Bunny83 · Oct 09, 2015 at 06:04 PM

You shouldn't even think about such an approach. Some kind of middleware shouldn't manipulate folders on my PC or trying to hide something inside the project. If you create middleware, your customers are other developers. If they break their project that's their problem.

There are two solutions which are acceptable:

  • Simply add a large comment header into the source file and explain that nothing should be changed in here or things can break. This is usually the best and easiest solution.

  • Compile your classes you don't want to be changed into an assembly. Of course you need seperate assemblies for editor and runtime code. Classes inside assemblies can still be used but not edited unless someone decompiles your assembly to get back the source code. This is what most plugin developers do. The advantage is that even several classes can be bundled into one "plugin". The disadvantage is that as a developer it's more difficult to understand what those classes do. They would need to use some kind of .NET reflector to decompile your dll.

Also keep in mind that if you want to create something for the assetstore that all users might want to use it. With all i mean also Mac and Linux users. Hacky solutions like hiding folders is a no go.

Comment
Add comment · Show 1 · 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 Jiraiyah · Oct 10, 2015 at 01:41 PM 0
Share

Hmm thanks for heads up, i didn't thought about mac and linux users, although i am already packaging the classes to a dll, but the thing is, what will sit inside that editor folder is a scriptable object that keep data related to editor stuff in it, those data will be related one to one to another scriptable object that is keeping the non editor and runtime stuff, the plan is to drop editor related data as building time so that the asset size and the amount of data being serialized become as $$anonymous$$imum as possible on run time. But i think you are right, specially when the thing i am developing would be a node editor for dialogue tree and behavior tree, then other users would be professionals, if not, the $$anonymous$$imum i can do is to figure a way to make a custom inspector with a bold yellow title alone that says, hey don't delete this asset manually and use the editor window :D

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

31 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 avatar image avatar image avatar image

Related Questions

How do I print out which folder in the projects tab is currently selected ? 1 Answer

Getting direct dependencies for an asset 1 Answer

How do I wait until after AssetDatabase creates an assets before carrying out another function ? 0 Answers

Help with Missing Monobehaviours and Asset Serialization? 0 Answers

How do I return the path of a sub-asset in an AssetDatabase ? 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