Hi… I can not understand why I get this error:
NullReferenceException: Object reference not set to an instance of an object
UnityScript.Lang.Extensions.get_length (System.String s)
SwipeControl.Update () (at Assets/Scripts/SwipeControl.js:192)
The code is just a minor modification of the “SwipeControl.js” by Markus Hofer.
I have it go to a button script that checks the link associated with the button, then refreshes the page wit the new page.
Here is part of the code - I can post more if you like…
I can’t figure out if its the subroutine " () ", or the code just after it, with the “touch”…
My error says its the “touch” that is the source of the error message…
PLEASE HELP!.. This is holding up a manjor release for my company!.. Thank-UUUUUUUU!!!
for(i = 1; i < prevSmoothValue.Length; i++) {
prevSmoothValue *= prevSmoothValue[i- 1];*
-
}* -
prevSmoothValue[0] = smoothValue;* -
}* -
grablink0 () ;* -
#if UNITY_IPHONE or UNITY_ANDROID* -
for(touch in Input.touches){* -
if (touch == null) {* -
//nothin * -
}* -
pos = Vector3(touch.position.x, Screen.height - touch.position.y, 0.0);* -
tPos = matrix.inverse.MultiplyPoint3x4(pos); * -
//BEGAN* -
print(tPos + " inside " + mouseRect + "?");* -
if (touch.phase == TouchPhase.Began && mouseRect.Contains(tPos)) {* -
fingerStartArea[touch.fingerId] = 1;* -
print("hit!");* -
}* -
//WHILE FINGER DOWN* -
if(fingerStartArea[touch.fingerId] == 1) { // no touchRect.Contains check because once you touched down you're allowed to drag outside...* -
touched = true;* -
//START* -
if(touch.phase == TouchPhase.Began) {*
_ smoothStartPos = smoothValue + tPos.x * partFactor;_
-
FillArrayWithValue(prevSmoothValue, smoothValue);* -
}*
…
HERE IS THE BUTTONS LINK SCRIPT IT JUMPS TO:
function grablink0() {
- // Code by Kris Roebuck of HangarApps / The App Hangar (A Division of MyFutureClub [USA])*
-
//grab value of button being pressed* -
var code_b = linkb;* -
print (code_b);*
// Goes to the link
screen1_b = WWW(code_b);
*yield screen1_b; // Wait *
// ANY ERRORS?
if (screen1_b.error){
print("Error: "+screen1_b.error);
-
TextHints.message = "ERROR (CHECK INTERNET CONNECTION)";* -
TextHints.textOn = true;*
} else {
-
var screenimb = (screen1_b.text);*
// assign text
*linkto = screenimb; * -
if (linkto.length == 0) {* -
///nothing* -
}* -
if (linkto.length >= 12) {* -
///webload web-page* -
}* -
if (linkto.length <= 5) {* -
loadkey.key = linkto;* -
Application.LoadLevel ("VIEWER");* -
}*
}
}