I've ran into another odd problem, whenever i put guiText.text = "random text";, the entire iff block seems to be skipped over. Without that code, it works fine. Why is this? guiText is a guiText object that works fine for other methods. What could make code be skipped over?
(Time.time - touch0BeginTime) will be non-zero, hence ‘true’ in the next frame. You need to compare it to some real amount of time, like
var longPressTime = 2.0;
(Time.time - touch0BeginTime) > longPressTime
sorry i forgot to type that, i have it in my code. just thought too quickly. Why would it skip my code though? And is there an order to using touchphases and such? Like if i test if touchphase == end before touchphase.began?
Thanks for the answers but i found a way to do it. It's similar to "timidguy" but i did checks in one line and had code to check my touch phases in order (doing them out of order seems to make unity skip execution of code between the out of order checks. And example is checking if TouchPhase.Began after checking TouchPhase.Moved. It's odd but unity hates it.
I've ran into another odd problem, whenever i put guiText.text = "random text";, the entire iff block seems to be skipped over. Without that code, it works fine. Why is this? guiText is a guiText object that works fine for other methods. What could make code be skipped over?
– 1337GameDevThe code was skipped because of a null reference. It irrationally skips code due to null references similar to segmentation faults in c++
– 1337GameDev