Turn on LED Light on iPhone using C#

I attached this method to a button to see if I could turn on the light on an iPhone;

	public void LightSwitch()
	{
			GetComponent<Light>().enabled = true;
	}

But it doesn’t work. Any ideas?

“Components” in Unity are scripts written in code that determine how (virtual) objects behave in your game world behave. They have nothing to do with the components on your phone.

“Lights” in Unity are one type of component - the (virtual) lights that determine how your (virtual) scene is rendered. They have nothing to do with any (real) bulbs that may light up on your phone. Unity - Manual: Types of light

However, it is possible to write a component that accesses the (real) light on your phone. You’ll have to write an Obj-C plugin and then interface to that from a C# component. Or, you could investigate a pre-written asset such as this:

To solve build errors: [ARC Restrictions] //Add Flag -fno-objc-arc in Xcode / Build Phases / Compile Sources / iOSTorch.mm