Shader LoD by frame rate?

So I’m pretty new to shaderlab and completely new to iphone developing. Trying to write my own shaders and I’ve got it working on the iphone 5, iPhone 4 and new iPad but with vastly different FPS on all three. I’ve read up on shader LoD’s but unless I’m mistaken this is something set at load not runtime. I’d like to use my main shader and then have it switch to a simpler sub-shader only if the FPS drops below a certain point. Is this at all possible?
If not then can you tell the shader to run a sub-shader based on iPhone version? I saw that you can use the platform check in script and set it that way but from what I saw that just tells you if you’re running on an xbox, pc, mac, iOS device, whatever. Not specific models of said iOS devise.

Any ideas would be much appreciated.

Well, Shader.globalMaximumLOD = n; will let you set the shader LOD level during run-time for all shaders.

Or you can set it for a specific shader by using Shader.maximumLOD = n;

Just ensure you have subshaders for each LOD level you want with LOD values set in them. Unity will pick the higest LOD it can based on the maximum value you set using those functions.

Thanks Farfarer. Any ideas on how I could set that LoD level based on which iPhone version it’s seen on?

Yeah, there’s stuff for finding that out…

iPhone.generation (http://docs.unity3d.com/Documentation/ScriptReference/iPhone-generation.html) returns one of these enums : http://docs.unity3d.com/Documentation/ScriptReference/iPhoneGeneration.html

aha, thanks so much farfarer