Hello
I am trying to make the .pressure API of unity to work with Apples 3D touch, My function is as follows;
public void Pressure2()
{
if (Input.GetTouch(0).pressure <= 0.66f)
{
mainCam.backgroundColor = Color.red;
}
else if (Input.GetTouch(0).pressure > 0.66f)
{
mainCam.backgroundColor = Color.white;
}
else if (Input.GetTouch(0).pressure > 2.66f)
{
mainCam.backgroundColor = Color.blue;
}
else if (Input.GetTouch(0).pressure > 4.66f)
{
mainCam.backgroundColor = Color.green;
}
else
{
mainCam.backgroundColor = Color.yellow;
}
}
What I am trying to do is changing the background of the camera according to force value.
But now when I click it it only becomes red!
Please help ![]()
also the button config:

Hi, main doesn't works( using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TouchPressure : MonoBehaviour { void Start () { } void Update () { } public void Pressure () { if (Input.touchCount > 0) { if (Input.GetTouch (0).pressure <= 0.66f) { //gameObject.GetComponent<Image> ().color = Color.red; print("ok"); } } } } Unity 2017.1 iOS Remote on iPhone SE
– alarm656Great! It is exactly what i was looking for! Thanks! ^.^ But how do i make something that block the script in some scenes? Because i don't want it to play in EVERY scene. But besides that, it's just wonderfull!
– Zitoox