Hello and thanks for taking the time to help me. The errors are present in lines 9 and 24 wherever ‘enabled’ is, I am not the best at coding and this is not my script. It worked for a long time until it suddenly crapped out on me (along with about 8 others which I have been able to fix) however this one no matter what I try I cannot fix. Any help is gladly, appreciated many thanks in advance.
You should include the portion where you define pauseFilter, but I’m guessing you left it as “var” and didn’t give it an explicit type, otherwise you’d have a better error than this. You should only skip defining the types of your variables in the cases where it’s completely obvious, like a temporary float, int, string, etc… that you use immediately after and never again IMO.
The better error (once you fix the variable not having a proper type) is likely going to be that “Cannot implicitly convert type Object to type PauseFilter” or some such thing, because the place where you assigned a component to the variable you likely used GetComponent(“typeName”) instead of GetComponent() or GetComponent(typeof(typeName))). If you must use the string representation of the type, make sure you cast it properly to the right type using (typeName) at the start or “as typeName” at the end.
#pragma strict
var skin:GUISkin;
private var gldepth = -0.5;
private var startTime = 0.1;
var nativeVerticalResolution = 1200.0;
var scaledResolutionWidth = nativeVerticalResolution / Screen.height * Screen.width;
var mat:Material;
private var tris = 0;
private var verts = 0;
private var savedTimeScale:float;
private var pauseFilter;
private var showfps:boolean;
private var showtris:boolean;
private var showvtx:boolean;
private var showfpsgraph:boolean;
var lowFPSColor = Color.red;
var highFPSColor = Color.green;
var lowFPS = 29;
var highFPS = 30;
//var start : GameObject;
var url = "WebPlayer.html";
var statColor:Color = Color.yellow;
var GuiColor:Color = Color.white;
Like the compiler, I still can’t tell what type it is. You see the problem? I updated my answer above while you were posting, but you likely have an error being obscured by the lack of an explicit type here, so change:
private var pauseFilter;
to include the type (the script/class name), then it’ll tell you what the real error is. It’ll probably be the conversion error that I mentioned in my previous post.
Ok, I am going to be honest with you I have absolutely no idea what you are talking about. would posting the entire code help in any way? I am truly sorry about this.
You need to specify the type. You see how you have the " : boolean;" at the end of the definition for the boolean values? You need to do the same thing for whatever class the pauseFilter is supposed to be. We don’t know what it is, and no, posting the whole script wouldn’t help because it’s referring to a different script. What’s the class of pauseFilter? Is it PauseFilter? If so, you can do “private var pauseFilter : PauseFilter;”
As I said though, this isn’t the real error, it’s just the result of the compiler not knowing what type it’s supposed to be. After you tell it the type though, it’ll let you know what the real error is.
Yes, the pauseFilter class is PauseFilter and when I tried the solution you gave me the error changes to
“BCE0018: The name ‘PauseFilter’ does not denote a valid type (‘not found’). Did you mean ‘UnityEditor.PS4BuildSubtarget’?”
Is the class in the current namespace? If it’s a part of some package or something, you may have to use an “include namespace” at the top for whatever namespace that class is a part of. Either that, or it’s mispelled, mis-capitalized, or the name of the class doesn’t match the name of the file.
I’m going to be ‘that guy’ and give you the real solution. Swap over to C#. The language is better, because it doesn’t give these type errors. It’s got better community support. And better documentation.
Doing anything even vaguely advanced is a nightmare in UnityScript.
I have no idea what namespace that package uses, but you can check the PauseFilter script yourself. At the top of the script, before the class definition, it should say “namespace SomeNameSpaceName{}” with the entire script inside of those braces. That’s the thing you want to use as “include SomeNameSpaceName;” at the top of your script.
This is assuming UnityScript can even use namespaces… I honestly don’t know.
The package did not include a PauseFilter Script. So What I did was delete everything that had to do with pauseFilter and that seemed to do the trick. Honestly if it weren’t for you I probably wouldn’t have know to do that so I really appreciate the help