- Home /
Question by
cuongkimh4 · May 30, 2014 at 02:11 AM ·
updatefixedupdatetouchphasefinger
Multitouch in update or fixedupdate
hello, first i'm sorry about my English. I have this code:
public class NewBehaviourScript : MonoBehaviour {
string texxt="";
// Use this for initialization
void Start () {
}
void OnGUI(){
GUI.Box(new Rect(100,100,100,40),""+texxt);
}
// Update is called once per frame
void Update () {
int numTouch = Input.touchCount;
for(int i=0;i<numTouch;i++)
{
Touch curTouch = Input.GetTouch(i);
if(curTouch.phase ==TouchPhase.Began)
{
texxt +="x";
}
}
}
}
if i touch one time, one finger in iphone screen when i use update function. GUI.box will show value of texxt = x or xx. If i use fixedupdate function. The value of text always is x, not xx. Any body help me? Thanks
Comment
Why would you want to use FixedUpdate? In general thats just for things like physics calculations.
curTouch.phase ==TouchPhase.Began --> the result of texxt will be x. I use update and the result is x or xx. xx is a problem because i block it in touchphasebegan. Why it run twice.
Your answer
![](https://koobas.hobune.stream/wayback/20220613150226im_/https://answers.unity.com/themes/thub/images/avi.jpg)