Posts

Showing posts from March 3, 2019

What is the class of function that when called repeatedly, has the same effect as calling once?

Image
1 A function that fulfills this criteria is int var = 0; void func1() { var = 10; } As you can see, calling fun1 10 times has the same effect as calling it once (assigns 10 to var ) A function that does not fulfill this criteria is int var = 0; void func2() { var++; } Calling func2 10 times results in var being assigned a different value as compared to calling func2 once naming functions share | improve this question asked 4 hours ago Woofas Woofas 277 1 3 ...

Unity3D: Input.GetKeyDown(KeyCode.Escape) doesn't work on mobile nor PC

Image
0 this piece of code doesn't work. When I set a breakpoint on the if statement, the debugger breaks. But the GetKeyDown never get's triggerd, when pressing Escape or the mobile back button (Android). void Update() { if (Input.GetKeyDown(KeyCode.Escape)) Application.Quit(); } I also tried if (Input.GetButtonDown("Cancel")) . Doesn't work either. I deployed the game to my mobile device. Maybe some settings have been messed up? Another project works just fine (2D Desktop). I also used the Unity Remote App. I am using Unity 2018.3.0b2? EDIT: Solved somehow. Unity Remote App maybe was an issue. Back button only works on real Android device. unity3d share | improve ...