Search Unity

How to create folder next to asset folder

Discussion in 'Editor & General Support' started by IfescaStewi, Nov 8, 2018.

  1. IfescaStewi

    IfescaStewi

    Joined:
    Sep 18, 2018
    Posts:
    2
    Heyhey,
    I recently got the Zen Fulcrum Embedded Browser asset for Unity and now I would like to call JavaScript with it.

    To do so, I am told by the documentation to create a "Browser Assets" folder next to my assets folder. Embedded Browser works if I just place "Browser Assets" manually in my project folder, but it I can't see it in my Unity folder hierarchy.
    Has anyone an idea?

    Greetings, Stefan
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    2,755
  3. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    3,605
    If it's a hard requirement to have a folder outside of the Assets then you can try to create a symlink to it inside the Assets.
    IDK exactly the method on OSX but on Windows 10 (in this example we're replacing the entire Asset folder with a link):

    - "windows" key
    - type 'cmd'
    - right click on the command line tool
    - run as administrator
    - navigate to the Unity folder with the "cd" command
    - mklink /J "LinkFolderName" "RealFolderName"

    example: mklink /J "Assets" "E:/BigAssDisk/Junkfolder/Working/Unity/AwesomeGame/Assets/"

    (do not forget to remove it for builds though)
     
  4. calebbbarton

    calebbbarton

    Joined:
    Mar 20, 2018
    Posts:
    8
    Because I found this in google, and didn't find a solution, here's my answer. Note: Editor only if that wasn't clear

    Code (CSharp):
    1. DirectoryInfo directoryInfo = new DirectoryInfo(Application.dataPath);
    2. string parent = directoryInfo.Parent.ToString();          
    3. Directory.CreateDirectory(parent + "\\myFolderName");
    This code gets the assets folder location, returns the parent of the project folder, and creates a new folder next to the assets folder.