Method Extension on Screen Class

I am starting to learn unity and I want to do a method extension to return if the device is retina (not implementing a plugin).
I am trying the following code:

ScreenExtensions.cs

using UnityEngine;

public static class ScreenExtensions {
    public static bool isRetina(this Screen scr) {
            return ( (Screen.width == 960)  ||
                     (Screen.width == 2048) ||
                     (Screen.width == 1136) );
    }

//    public static bool isGiraffe(this Screen scr) { return (Screen.width == 1136); }

}

but it gives me the error message " error CS0117: UnityEngine.Screen' does not contain a definition for isRetina’"

what I am doing wrong?

I believe you cannot add static extension methods

Just place this in your own utility class instead.

Have you completed the method itself btw?
I am also interested in creating a safe isRetina() method, hopefully one that does not need to rely on specific screen resolutions as you may not know what the future brings and you cannot possibly own all the different android devices…

You should use Screen.dpi anyway; checking resolutions wouldn’t be reliable.

–Eric

Yeah, I saw this Unity answer and upvoted the answer that proposed dpi, as it definitely seems a good direction to go to.

Its just that I do not own enough cough any cough retina devices to know what is the range of DPI that should be considered retina.

What would be your suggestion Eric? Check if Screen.dpi > someNumber ? Any idea what that number is, or is there some research in my future?

Ha!

( with PPI table per device, so iPhone is easily covered, still need to figure out Android )

And a longer list, with too many details, but perhaps will help someone…
http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density
Talk about market fragmentation…

I use to create a new class called _GUI where I always add those kind of stuff like :

deviceType (iphone, iphone 5, ipad) for the ratio type
coefSize (ipad, ipad 3, etc… or iphone3GS, 4, 5, etc… ) for screen scale type. >> ipad 3 (hi-res) is a coef 1.
etc…

From here all my script got an initialization querying my _GUI class.

I must be missing something as I currently use http://docs.unity3d.com/Documentation/ScriptReference/iPhoneGeneration.html - why are you checking resolution again?

To be sure my code still running if a new device is released.

Also if you work on other platform like Android or PC, mac, etc… the best scripting way is the generic method running for sure on both support.

I am always warmed using too specific functions…
It also save bunch of work as well.

I completely agree with this approach. The questions we ask should be based on capability and not make-and-model.
The make and model properties, are sometimes the only tool to determine capability, but this should be the last resort.