Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
3
Question by Digital-Phantom · Mar 16, 2015 at 03:07 PM · c#classnamespacepubliccontext

Can't access another script, think it may be due to namespace/public class ?

I'm having trouble accessing another script in my project. This is the script I want to access -

 using System;
 using UnityEngine;
 
 namespace UnityStandardAssets.ImageEffects
 {
     [ExecuteInEditMode]
     [RequireComponent (typeof(Camera))]
     [AddComponentMenu ("Image Effects/Camera/Vignette and Chromatic Aberration")]
     public class VignetteAndChromaticAberration : PostEffectsBase
     {
         public enum AberrationMode
         {
             Simple = 0,
             Advanced = 1,
         }
 
 
         public AberrationMode mode = AberrationMode.Simple;
         public static float intensity = 0.0f; //I CHANGED THIS TO A STATIC VARIABLE !
 

and I'm using this script to access/change the other script -

 using UnityEngine;
 using System.Collections;
 
 public class FadeOut : MonoBehaviour
 {
 
     private bool levelCompleted = false;
     public float fadeAmount;
     
     void OnTriggerEnter(Collider collider)
     { 
         if(collider.gameObject.name == "Player")
         {
             levelCompleted = true;
         }
         
     }
     void Update()
     {
         if(levelCompleted = true)
         {
             VignetteAndChromaticAberration.intensity += fadeAmount;
         }
     }
 }
 

I'm getting this error -

Assets/Scripts/FadeOut.cs(22,25): error CS0103: The name `VignetteAndChromaticAberration' does not exist in the current context

I think (please correct me if I'm wrong) its something to do with namespace / public class. I've not come across a script yet that uses the namespace thing so that I tink is why I having issues with finding the 'other' script.

???

Comment
Add comment · Show 3
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 Digital-Phantom · Mar 16, 2015 at 03:19 PM 0
Share

@Glurth

$$anonymous$$any thanks.... sorted :)

Want to move your reply to answers section so I can up-vote it for you.

avatar image Baste · Mar 16, 2015 at 03:32 PM 0
Share

Fixed the moving and accepting for you.

avatar image Digital-Phantom · Mar 16, 2015 at 03:39 PM 0
Share

and prevented me from gaining karma...lol But thanks anyway

;)

1 Reply

· Add your reply
  • Sort: 
avatar image
6
Best Answer

Answer by Glurth · Mar 16, 2015 at 03:11 PM

You'll need to include:

 using UnityStandardAssets.ImageEffects;

at the top of any file that wishes to access that namespace.

Comment
Add comment · Show 2 · 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 BlastOffProductions · Mar 29, 2017 at 12:00 AM 0
Share

Thank you!

avatar image AwesomeAlexx · Feb 10, 2020 at 11:02 AM 0
Share

What about the oposite ? I'm using a namespace and can't access other scripts whithout namespace inside that one.

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

24 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

Related Questions

JS to C# class conversion issue. 1 Answer

How to make classes/structs public to all scripts 0 Answers

Weird error while trying to call a void from another class 1 Answer

What's the point of declaring a C# script a public class? 2 Answers

Parameter Name Need "Some Generator Here" is a duplicate 2 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