Extension class won't recognize the type in some imported namespace

Please help, i’m losing my mind. I created a class for housing a Quaternion extension method. However, after “successfully” importing the unity engine namespace, the Quaternion struct (class?) still goes unrecognized. I could go and explicitly add the “UnityEngine.Quaternion” namespace qualifier in front of each every occurrence of the Quaternion type name in the file. Though, that would be ugly. I’ve added a screen cap of the class. The namespace of this extension method’s class is shown at the very top of the image -FYI.

Please help, i have many other extension methods that i need to add later, and adding the “UnityEngine” namespace qualifier in front of each and every occurrence of “Quaternion” would be suck.

Thanks in advance.

Do avoid using class names in namespace names. The compiler doesn’t know what you want to refer to. You could probably fix it by moving the using line into your namespace, however I’m not sure about that. The only other way would be to use the fully qualified class name including the namespace (i.e. UnityEngine.Quaternion).

Apart from that you are heavily abusing extension methods. This is no extension method at all since you don’t do anything with the quaterion that method is used on. This is horribly misleading. Also the usual pattern for methods that work with struct types is to return the modified result. So I would highly recommend to implement the method like this:

public static Quaterion Exp(this Quaternion a)
    // [your code goes here]
    return a;

then you can use this extension method (once you imported the namespace of course) like this:

Quaternion someQuat;

someQuat = someQuat.Exp();