Search Unity

Namespace UnityStandardAssets not found

Discussion in 'Scripting' started by CG_Echtzeitschmiede, May 10, 2015.

  1. CG_Echtzeitschmiede

    CG_Echtzeitschmiede

    Joined:
    Feb 19, 2015
    Posts:
    93
    The Unity documentation says that in order to access image effects through scripting I must include:
    using UnityStandardAssets.ImageEffects;

    Straightforward. However, when going back to Unity, the console gives me the following error regarding this line:
    Assets/Scripts/GUI/Inventory.cs(3,7): error CS0246: The type or namespace name `UnityStandardAssets' could not be found. Are you missing a using directive or an assembly reference?

    I have all image effects working correctly inside the project, but I cannot access them through scripting. What's going on?

    P.S.: Unity 4.6.3
     
    sbagchi likes this.
  2. BenZed

    BenZed

    Joined:
    May 29, 2014
    Posts:
    524
    I imagine you'll also need to import the unity package into your project.

    Assets > Import Package > Effects
     
    Deniz2014, pontaro and waleedmm like this.
  3. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,665
    Afaik this only applies to Unity 5 and is not needed in Unity 4.
    In order to call Image Effects, use GetComponent:

    C#
    Code (CSharp):
    1. GetComponent<DesiredImageEffect>()
    2. EX: Camera.main.GetComponent<Vignetting>().enabled = true/false;
    JS:
    Code (JavaScript):
    1. GetComponent("DesiredImageEffect")
    2. EX: Camera.main.GetComponent("Vignetting").enabled = true/false;
     
    Last edited: May 10, 2015
  4. CG_Echtzeitschmiede

    CG_Echtzeitschmiede

    Joined:
    Feb 19, 2015
    Posts:
    93
    Indeed this works, thank you very much.

    What had thrown me off was MonoDevelop's code completion does not pick this up at all and displays <Vignetting>().enabled in red. But the code works in Unity. Having code completion would be useful but is not a necessity.
     
  5. avi9111

    avi9111

    Joined:
    Feb 24, 2016
    Posts:
    31
    Ok, It was done with this operation
     
  6. thorhammer2301

    thorhammer2301

    Joined:
    Jan 14, 2020
    Posts:
    10
    *using UnityStandardAssets.Character.FirstPerson;*
    including this line...it throws an error this

    *Assets\GroundBehaviour.cs(4,7): error CS0246: The type or namespace name 'UnityStandardAssets' could not be found (are you missing a using directive or an assembly reference?*
     
  7. AdosMo

    AdosMo

    Joined:
    Apr 9, 2020
    Posts:
    3
    I am trying to make myself get in a standard assets jet. But it still doesn't work
     
  8. skjagan

    skjagan

    Joined:
    May 18, 2020
    Posts:
    6
    Please tell me if you a way.
     
  9. thorhammer2301

    thorhammer2301

    Joined:
    Jan 14, 2020
    Posts:
    10
    you have to add standard assets pack from unity store if you don't have already...:)
     
  10. Acuteimpulse

    Acuteimpulse

    Joined:
    Apr 10, 2020
    Posts:
    1
    I have added standard assets pack. Yet I am getting same error.
     
  11. arpitsrivstva

    arpitsrivstva

    Joined:
    Apr 18, 2021
    Posts:
    5
    I am not getting how should I do the asset thing you told, as when i am clicking import package, there's only one thing listed - "custom package". Please tell me how to fix this whole errrorrr!
     

    Attached Files:

  12. That comment was for Unity 4.6.3 as they talked about it. That package was deprecated and moved to the Asset Store.
    https://assetstore.unity.com/packages/essentials/asset-packs/standard-assets-for-unity-2018-4-32351

    But you will need to use an older Unity version to use it.
     
  13. arpitsrivstva

    arpitsrivstva

    Joined:
    Apr 18, 2021
    Posts:
    5
    so what should I do. Actually I am not able to add/drag that "move" scripting file to the Sphere gameobject. Whenever i do, that popup's coming. Please help!
    I think thats the Mono Behaviour thing which is coming in between. Please tell what to do. No other option except Visual studio is coming in the preferences, like in following this thing - "Edit> Preferences > External Tools> Here we have the option: External Script Editor: we can select MonoDevelop (built-in)"
     

    Attached Files:

    Last edited: Apr 18, 2021
  14. I'm guessing you're trying to follow some sort of tutorial. Check what version of Unity was written for. Download that version if you want to follow that tutorial. Or choose another tutorial, there are plenty without using that package too.