[Solved] "Cursor/Touch is on " Not Working Proper


#1

When I press the LevelMap it do not change the scene, instead it restart the current level… It creates a loop when the button is pressed, the level runs again and again. Also LevelMap Scene loads but it switchs back to this level. Don’t know why.
I have used it many times but this is the first time it is showing this behavior.
Problem only occurs in Android Phone.
How to do this problem.


#2

Change to scene “Level Selection”

Is “Level Selection” the name of the scene or the name of the variable?
If this is a scene, make sure you spelled correctly, in case it is a variable, I woudl recommend to remove the empty space from the name and use the expression VariableString(LevelSelection) or in case it is a number ToString(Variable(LevelSelection))

The other possibility is that, the moment you switch to the LevelMap, something triggers on the level map to switch back to scene you were on. When do you switch from the level map to the scene you are on?
For example if you have the button on the level map and the scene the same place, you may end up switching back and forth because the moment you switch, the cursor is already on the button and trigger to switch back immediately.
In order to avoid situations like this you want to add the condition to check if mouse button released also, but it does not work on mobile, on mobile you need to use the condition to test if touch has ended instead.
Or just make sure the button is at a different location if that’s the case.


#3

Level Selection is a scene.
The problem only occur in phone.
There is no button at the same place of LevelMap in Level Selection Scene.


#4

How can I upload my game project so that you can see it.


#5

In case the name of the scene “Level Selection” is correct, the game should switch to Level Selection, but in case the scene only “restart” for you then it means after switch to Level Selection the game immediately switch back to the level you are on.
So however you switch from Level Selection to the scene where you are currently on, must be the cause and the scene is not restarting but go to Level Selection and back to the scene.

So how do you normally switch from “Level Selection” to the scene that restart? How is it supposed to work? By pressing a button on level selection scene or something?

You can use https://send.firefox.com/ to upload your game temporarily.


#6

Download “game.json” with Firefox Send: simple, safe file sharing https://send.firefox.com/download/8280cebc06c0452f/#1hz0LGlgprJimtQgBeYlDA

Above is the prototype project of my game. Same problem also occur here but this time the problem is seen in the editor too.
Please see it.


#7

You forget to add the condition in Scene1 to switch to LevelMap if the mouse/cursor is on the button, you did also forget to add the button object to level 1.
So when I tried to switch to level 1 from LevelMap, it did switch to Level 1 but than immediately switched back to the LevelMap.

Also, the scene is called “LevelMap” and not “Level Selection”.

Adding a button object and a condition to switch to “LevelMap” if mouse/touch is on the button did solve the problem for me, I was able to switch back and forth between all 3 levels and the levelmap.


#8

This is not my original game project. I made this just to show the problem I am facing.

Can you share the project u fixed


#9

Sorry I have deleted but all you need to do is add the condition in level 1 to check if mouse is over object and also don’t forget to add the object too. You did it right in level 2 and 3, it is only level 1. That was the problem in this project, but it could be something else in your real one.


#10

Download “Screenrecorder-2019-05-12-09-38-59-727.mp4” with Firefox Send: simple, safe file sharing https://send.firefox.com/download/50a06a138775a11e/#keT5q7JMdid0sos_UjLSBw
Have a look here. When ever I click on levelmap button in my original game project it restart the level1, it never goes to levelmap scene(called Level Selection Scene in original game)
Note: This problem only occur when I play the in my Android Phone. In editor it works fine.
The picture I share in the starting is from my original game project.


#11

I’m afraid it doesn’t really help. The only thing I can see from the video is that the game does change the scene to level selection and then go back to level 1 but I am not sure why it does it on mobile only.

The only thing I can think of is that your thumb is so big or the screen so small when you press the level map button on the top of the screen, the moment you switch to the level selection you pressing the Back button too or in case you did not disable moving the cursor with touch, you leave the cursor there on the top which is manage to be just over the back button or the level 1 button.

Try to put the level map button in the bottom right corner to make sure you don’t accidentally press the back or level 1 button on the level map screen with your thumb when you switch.

In case it doesn’t solve the problem on mobile with touch but it does work in preview on your PC with a mouse, I’m not sure what else could cause this only on mobile without able to see the actual events and try it for my self. If you want, send me the project with all assets in private and I can have a look today but otherwise I’m not sure what is happening.


#12

I will send you the project. Pls have a look


#13

I have to upload whole project or just json file


#14

I would prefer the whole project otherwise I need to add images myself in order to try.
If you want you can remove all the levels, all I need is level map and level1 and the assets for those two.


#15


This is not uploading whole project folder… Any other site or way


#16

How big is your project? You should be able to upload 1GB. If you register it is 2.5GB.
You can remove all songs and audio, all levels. All I need is the level map and level 1, the images for these two scenes and the event to switch between them. You can even remove game logic for player controls, enemies…etc. I don’t need any of that.


#17

It’s just 2mb in size


#18

So what does it say when you try to upload it?


#19

You also should be able to upload it here by drag and drop it in to the reply box.


#20

It just open the folder and letting me select the files and images individually.
Can I drag and drop the folder in the reply box. Wait
Currently I have using phone. Wait I will upload it from laptop