Recursive extension methods

So what I want to do is to have my extension have “sub -extension” as transform.position has .x , .y and .z I want my code to have similiar things but i can’t think of anything that would work and nested classes don’t work.

Hi,
what you mention are members of a struct.
Something similar to

public struct Vector3
{
    public float x;
    public float y;
    public float z;
}

The Transform component has a position member of type Vector3.

Now “extension” methods extend a type. Like this :

static public class Extensions
{
	static public Vector3 MyMethod (this Vector3 v3)
	{
		return v3;
	}
}

This allows you to call the new method on a variable of that type. Like

Vector3 _position;
_position = _position.MyMethod();

The return type must be the same as the type passed with this keyword.

Did you add “[System.Serializable]” to your nested class?
Check here, if you wanna know what I mean: