Unity not allowing me to use Screen.safeArea - unity3d

I am trying to adjust the UI in my game to properly fit on the screen of an iPhone X.
In my code I am attempting to code the line return Screen.safeArea
However 'safeArea' is highlighted red and when I hover over the error with my cursor a message is displayed saying "error CS0117: 'UnityEngine.Screen' does not contain a definition for 'safeArea'".
I dont understand why I'm getting this error because according to Unity's documentation UnityEngine.Screen does contain a definition for safeArea.
Any inclination or idea as to why I am running into this error?
Also, I am working with Unity 2017.2.0f3
As per comments bellow, code as been asked for.
private Screen ReturnSafeArea(){return Screen.safeArea}
as I tried saying, the code has nothing to do with it. Even in this simplistic instance of the use of Screen.safeArea, safeArea is listed as not a definition of UnityEngine.Screen.
Hovering over safeArea displays the following message
"'Screen' does not contain a definition for 'safeArea"

Screen.screenArea is of type Rect and your method is defined as returning a value of type Screen
https://docs.unity3d.com/ScriptReference/Screen-safeArea.html
One way to correct this:
private Rect ReturnSafeArea(){
return Screen.safeArea;
}
Additionally, the field was added in 2017.2.0p1 (Nov 6) and you're on 2017.2.0f3 (Oct 3). Link is for 0.2, but 0.f3 does not have its own page, so likely was made either the same day or very shortly after.

I believe Screen.safeArea was added in a minor release of 2017.2, so 2017.2.0f3 would not have it. Try your code in 2017.2.1 and newer to confirm. It's too bad the documentation doesn't specify that.

Related

Where is Self._printChanges() defined and/or documented for SwiftUI?

I have seen a few articles or video's on iOS 15's new Self._printChanges() function, but can not find any documentation on it anywhere. Does anyone know where Apple documented this new function? It is pretty obvious how to use it, but I would like to see what more we can do with it and knowing more about it would be helpful. Even Xcode's lookup's yield nothing. Anyone find anything?
Unfortunately, _printChanges() is a private API, which is why it's undocumented. The only reason so many videos and articles referenced it is because an Apple engineer mentioned it during WWDC21. Here's what they said:
It's not technically API-notice the leading underscore — so should only be used in debugging. My one sentence pro-tip is the extent of the docs I'm afraid.
However, Xcode does show a summary when you Option + Click.
Summary
When called within an invocation of body of a view of this type, prints the names of the changed dynamic properties that caused the result of body to need to be refreshed. As well as the physical property names, “#self” is used to mark that the view value itself has changed, and “#identity” to mark that the identity of the view has changed (i.e. that the persistent data associated with the view has been recycled for a new instance of the same type).

Trigger featherlight.js by clicking image without <a> element

Is there a way to get featherlight.js to trigger on an image itself, as opposed to a surrounding link?
For example, I'm trying this:
$('img.pop').featherlight($(this));
But getting an error:
a.cloneNode is not a function
Should not be a problem. The problem is probably what is this in your code above. That's why my advice to anyone ever reporting a problem is to produce a working example.

Swift ViewController does not respond to -getFile, Could not connect action, target class

My code works all fine but there is always two console message every time I run it.
app works fine but the messages just bugs me so much. Could anyone tell me what is wrong with my code and what does these console message means,thanks
2016-06-13 14:31:15.014
LazyHackintoshGenerator[1625:37250] Could not connect action, target class
LazyHackintoshGenerator.ViewController does not respond to -getFile:
Select your ViewController.
Right-click on its “View Controller” icon (the blue circle with a white square inside).
Look for warning icons (yellow triangles).
Hover over them. An explanation of the problem will appear.
As Feldur said, the problem is probably a leftover link from your storyboard to a method that does not exist anymore (maybe you renamed it or deleted it manually). Remove the link by clicking on the cross, and, if needed, re-link to the appropriate method in your code.
Here is an example of what it will look like in Interface Builder.
Likely a control's action in your storyboard is linked to a method getfile that no longer exists

What does this icon in Eclipse mean?

I am referring specifically to the green plus sign in the screenshot below.
[edit] This is taken from "Outline" view, and I am coding in Java.
This might help:
What do the icons in Eclipse mean?
From the icon index, the plus means add, the C means public class, and the warning means that there is a java element warning.
So from what I can assume, it means you can add a new public class, but is warning you of possible problems with your current project.
The green + sign is an overlay that shows that the visibility of the class is set to public. The orange is a warning that there could be a potential issue in that class. This might not necessarily stop your class from running or performing well. It is just telling you to be aware of something that may or may not be harmful.

How to take ScreenShots of C# Exceptions through Programming?

I know how to take a Screen Shots through Programing but i want to take ScreenShots of the Exceptions Which I show in a messagebox appear runtime? Is it possible to do? please Suggest me...Thanks in Advance
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(bitmap as Image);
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
bitmap.Save("c:\\screenshot.jpeg", ImageFormat.Jpeg);
If you want a screenshot of a message box created using MessageBox.Show(), it's going to be a bit tricky. Here are several options:
Skip the screenshot and capture the content of the error instead, using ex.ToString() (where ex is your Exception object).
Create a custom message box form so you can grab its size and position for your screenshot.
Use the title of the message box to find its handle and see if you can get its position and size. Frankly, I'm not sure this will work at all.
Also, keep in mind that MessageBox.Show() is modal. If you put your screenshot code after this line, the message box will be gone before your code runs. You can work around this with a thread, but that's also probably more work than it's worth, and may be unreliable due to timing issues.
Personally, I would recommend just using the content of the error and skipping the screenshot. It will be far more useful, and can include information you don't want to show the user in the message box.