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 comomomo · Jul 18, 2017 at 08:29 PM · shadershaderscg

Is it possible to make a global cginclude inside of the asset directory?

I've been toying around with this and discovered that:

absolute and relative paths are supported for cgincludes-- You can write things like #include "Assets/cgincludes/mycginclude.cginclude" or just stick it next to the file and write #include "mycginclude.cginclude"

BUT

You can't get a global reference to a cginclude without slapping it into "\Unity\Editor\Data\CGIncludes" in the editor directory itself.

So I'm in a tough position because for my usecase I need a globally reference-able cginclude that exists in the project without an absolute path -- is this possible?

Comment
Add comment · Show 4
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 Bunny83 · Jul 18, 2017 at 10:09 PM 0
Share

The terms "globally" and "absolute path" are in most cases synonymes. The CGIncludes folder of the editor also represents an absolute path. It can't be changed. Likewise you can define a fix relative path inside your project.

What's the problem with using "Assets/cgincludes/mycginclude.cginclude" if that works? If you fear the long path, place the main CG file directly inside the Assets folder:

 "Assets/main.cginc"
avatar image comomomo Bunny83 · Jul 19, 2017 at 12:02 AM 0
Share

$$anonymous$$ostly just worried about folks wanting re-organize their projects for an asset store plugin~

avatar image Bunny83 comomomo · Jul 19, 2017 at 12:53 AM 1
Share

I know what you mean, but cg includes are purely based on file names / paths and do not represent "assets" in term of Unity's AssetDatabase. Unity doesn't provide a "default" search path or a special folder for cg includes inside projects.

Even if it would support a special folder, most special folders still need to be at the root so it's still a fix path. The only special folder names that can be anywhere are "editor" and "resources" folders. Well the $$anonymous$$aterials folder could be mentioned as well, but that's just a feature of the model importer.

If you want to provide a consistent path, place it inside a folder inside "Standard Assets" since the Standard Assets folder is always at root by definition.

Show more comments

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

105 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 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 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 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

UnityObjectToClipPos is inverted? 0 Answers

Shaders problems after moving to URP 0 Answers

Flat Shading / No Vertex Interpolation 2 Answers

Access to svPosition in fragment shader 1 Answer

Using custom keywords in cg shaders 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