- Home /
default parameter specifiers are not permitted
Ive been trying to build the following code that comes up with 3 of the same errors "default parameter specifiers are not permitted".
public static void SetCameraBounds(Camera cam = null) { // error
// If no Camera was passed in, use the main Camera
if (cam == null) cam = Camera.main;
// This makes a couple of important assumptions about the camera!:
// 1. The camera is Orthographic
// 2. The camera is at a rotation of R:[0,0,0]
// Make Vector3s at the topLeft and bottomRight of the Screen coords
Vector3 topLeft = new Vector3( 0, 0, 0 );
Vector3 bottomRight = new Vector3( Screen.width, Screen.height, 0 );
// Convert these to world coordinates
Vector3 boundTLN = cam.ScreenToWorldPoint( topLeft );
Vector3 boundBRF = cam.ScreenToWorldPoint( bottomRight );
// Adjust their zs to be at the near and far Camera clipping planes
boundTLN.z += cam.nearClipPlane;
boundBRF.z += cam.farClipPlane;
// Find the center of the Bounds
Vector3 center = (boundTLN + boundBRF)/2f;
_camBounds = new Bounds( center, Vector3.zero );
// Expand _camBounds to encapsulate the extents.
_camBounds.Encapsulate( boundTLN );
_camBounds.Encapsulate( boundBRF );
}
// Checks to see whether the Bounds bnd are within the camBounds //error
public static Vector3 ScreenBoundsCheck(Bounds bnd, BoundsTest test = BoundsTest.center) {
return( BoundsInBoundsCheck( camBounds, bnd, test ) );
}
// Checks to see whether Bounds lilB are within Bounds bigB //error
public static Vector3 BoundsInBoundsCheck( Bounds bigB, Bounds lilB, BoundsTest test = BoundsTest.onScreen ) {
I've already looked at the solution to the problem at http://answers.unity3d.com/questions/176305/default-parameter-specifiers-are-not-permitted.html. The solution says to go change something in the project options, but my project options is grayed out. What do i need to do to fix this?
That absolutely sure depends on .Net version you are using to compile your project. By default in $$anonymous$$onoDevelop it is set to something like 2.0 and thus does not support default parameter specifiers which were implemented in versions 4.x, as I recall.
So if you are using $$anonymous$$onoDevelop, click on Project drop-down menu, select Assembly-CSharp Options, in Build section in left menu pick option General and set option Target framework to $$anonymous$$ono / .Net 4.5.
That should work. If it does not, probably your project did not loaded properly.
I dont see Assumble-CSharp Options under project. The only paths i have are create package, active configuration, apply policy, export policy, and solution options.
When you open $$anonymous$$onoDevelop, are there any error messages appear?
On the left side there should be Solution Pad, where you can see your source files. Is everything ok inside it? Can you make a screenshot of that pad?
$$anonymous$$onodevelop opens without any error messages. Could it have something to do with unity? When i open unity theres an error at the bottom that says. Assets/__Scripts/Enemy.cs(16,31): error CS1525: Unexpected symbol (', expecting
)', ,',
;', [', or
='
That's just compilation error. $$anonymous$$ake a screenshot of your solution, please.
Answer by Bunny83 · Mar 13, 2015 at 02:52 AM
You have to select your project in the Solution Pad in order to have the "Assembly-CSharp Options" button enabled. A solution can contain multiple projects. The easiest way is to select the project "Assembly-CSharp" in the solution pad and right click on it. There you will also find a button called "Options" (almost at the bottom).
Alright that fixed it. Guess i didnt know as much as i thought. Thanks
I have the same problem and i cannot solve it by changing the build settings. What can i do?
Forget it. I solved it by changing the "Assembly-CSharp" , "Assembly-CSharp-Editor", "Assembly-CSharp-firstPass" and "Assembly-CSharp-Editor-firstPass" build options like its mentioned on the other comments.
Your answer
Follow this Question
Related Questions
How come the exe file disappears when my friend tries to run a build of my project? 1 Answer
Help building with two conflicting plugins: GameAnalytics and Google Play Services 2 Answers
Why does my Mac build to Android fail? "Unable to install apk!" 1 Answer
SetScriptingDefineSymbolsForGroup working is strange 0 Answers
Unable to create Windows x86 build. Error: "Unknown Binary Format" 1 Answer