Macros UNITY_IPHONE

it is working in C#?

#if UNITY_IPHONE

public class cls
{
	public static void Test()
	{
		Debug.Log("1");
	}
}

#else

public class cls
{
	public static void Test()
	{
		Debug.Log("2");
	}
}

#endif

Run in editor and on iphone give “1”.

That’s the correct behavior. You want that code executing in the iPhone editor and on the iPhone. If you ran that in the Unity Web tool you’d get “2”.

If you want code to only run on the iPhone, or only in the editor you can use checks like Application.isEditor

thanks