Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 3.2 UnityEngine.iPhoneInput.touches is obsolete >>> Why ?

Discussion in 'iOS and tvOS' started by KeepTrying, Feb 26, 2011.

  1. KeepTrying

    KeepTrying

    Joined:
    Feb 23, 2011
    Posts:
    119
    Hi people look whats wrong here ?

    WARNING: 'UnityEngine.iPhoneInput.touches' is obsolete. touches property is deprecated. Please use Input.touches instead.

    var textura:Texture2D;
    var texturaover:Texture2D;

    function Update () {
    for (var i = 0; i < iPhoneInput.touchCount; i++){
    var touch : iPhoneTouch = iPhoneInput.touches;
    if (touch.phase == iPhoneTouchPhase.Began) {
    guiTexture.texture=texturaover;
    }
    if (touch.phase == iPhoneTouchPhase.Moved) {
    guiTexture.texture=textura;
    }
    if (touch.phase == iPhoneTouchPhase.Ended) {
    Application.LoadLevel(Application.loadedLevel+1);
    }
    }
    }
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nothing is wrong, read the warning again and do what it says. It's very straightforward. (As for "why", because touch input isn't limited to the iPhone, so the name doesn't make sense.)

    --Eric
     
  3. KeepTrying

    KeepTrying

    Joined:
    Feb 23, 2011
    Posts:
    119
    Ok working on it many thanks buddy !
     
  4. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    I suggest you use Input.GetTouch() instead of the Input.touches array. It does the same but performs better, because accessing the array causes heap allocation.