I am using Unity 5.3.5. I have a script that I wrote under the Unity Assets/MyScript folder.
ScriptA.cs
public class ScriptA : MonoBehaviour
{
//code here
public static bool flag_I_want_to_reference;
}
Then, because I am using the Unity standard asset vehicle/car thing, it is in a separate namespace in a different folder path (i.e. not in MyScripts folder but in a different path under Assets)
SomeCarScript.cs
namespace UnityStandardAssets.Vehicles.Car
{
public class SomeCarScript : MonoBehaviour
{
//code here
bool foo = ScriptA.flag_I_want_to_reference;
}
}
Now, I have a bool that I want reference from within the SomeCarScript.cs but I am getting the error The name 'ScriptA' does not exist in the current context
I am trying to figure out what class/reference I need to have with using statements on the top of the SomeCarScript.cs script to make this work. I have tried looking up global namespaces and tried global::ScriptA.flag_I_want_to_reference and global::flag_I_want_to_reference but that doesn't work. I have also tried using "Assets/MyScripts/ScriptA.cs;" but that doesn't work either.
Any help would be greatly appreciated.
MonoBehaviourwhich should be pointed out by the compiler, but that should give you aType or namespace not foundcompiler error. If you wrote the code directly into your question (that's what it looks like), that looks like an honest mistake.SomeCarScriptis in?SomeCarScriptis underAssets/StandardAssets/Vehicles/Cars/ScriptsScriptAis underAssets/MyScripts