Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Sharing violation

Discussion in 'Scripting' started by Earthquake, Oct 5, 2011.

  1. Earthquake

    Earthquake

    Joined:
    Nov 2, 2010
    Posts:
    261
    Is there a better way to create a script in the editor.
    I tried this but got a error

    if(Button...)
    {
    System.IO.file.create(Application.datapath + "FileName.js");
    }

    Error

    Sharing violation on path "C/....../.../..."

    Please help
    Thanks
     
  2. eTag96

    eTag96

    Joined:
    Oct 24, 2010
    Posts:
    110
    Right click in project tab, and click on c# script or JavaScript or boo script.
     
  3. Earthquake

    Earthquake

    Joined:
    Nov 2, 2010
    Posts:
    261
    I know that, I need to know how to create it in a editor "script"
    Thanks
     
  4. bdev

    bdev

    Joined:
    Jan 4, 2011
    Posts:
    656
    you'll want to use just

    "Assets/" + "FileName.js"

    The current directory defaults to the folder containing assets and library.

    Once your done writing all your scripts call AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate)

    Be warned though, if theres a error in your generated script its hard to back out of it. Like if you have a member in another script using the script's class name and some generation error occurs you'll have to fix errors manually because you cannot just delete it. So if you cannot compile and you make a fix in your generator it wont matter because unity will not compile until there are no errors.

    Though you may be able to get past it if your Editor directory is in the standard assets or plugins folder.
     
  5. vackser123

    vackser123

    Joined:
    Oct 12, 2011
    Posts:
    11
    well theres a easy way to fix this
    type in terminal
    F(file name ass wipe)
    type that in exatcly
     
unityunity