You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No touch callbacks after application. Loadlevel #136
When you reload a scene you lose all objects which are not marked as NotDestroyOnLoad.
So most likely the functions you use to subscribe to events are gone too with these objects.
My new objects created in the scene register their callbacks when the new scene loads. I wouldn't consider it good practice to treat touch handling in a singleton like fashion
Confirm it in my 2D game project too. Unity 4.5.5f1, TouchScript 6.2 from assetstore.
I create game objects from prefabs, which contain SimplePangesture, TapGesture and Transformer2D in order to let user drag them to some location.
So, reloading same scene by "Restart level" or loading next level breaks "object panning" behavior, however I am still able to see clicks by attaching Touch Debugger prefab to the "broken" level.
And I cannot make these objects singletons, since they are to be destroyed in the game process.
Spent some time on syntethic project to understand things better, but failed to reproduce the behavior and, thus, sending original project to your mailbox. Check it out, pls
This was happening because TouchManagerInstance objects somehow got created and saved to scenes out of Play Mode. You can open a scene and search for "m_Name: TouchManager Instance". Not sure how they came through into scenes.
Activity
jswigart commentedon Nov 17, 2014
FYI I've verified that the callback registration happens each time the scene is loaded.
jswigart commentedon Nov 17, 2014
Also, using win7,mobile,mouse
neciu commentedon Nov 25, 2014
Confirmed.
valyard commentedon Nov 28, 2014
Can you provide an example?
I'm testing with Examples.scene.
Added this script on an empty GameObject:
I'm getting "TOUCH!!!" messages even after changing scenes.
jswigart commentedon Nov 28, 2014
I can't at the moment as I'm on travel, but iirc it works in the unity editor but not in a standalone window build. Maybe that will help.
jswigart commentedon Nov 28, 2014
Btw why would you mark that not destroy on load? Is anything that registers touch callbacks intended to be persistent?
valyard commentedon Nov 28, 2014
When you reload a scene you lose all objects which are not marked as NotDestroyOnLoad.
So most likely the functions you use to subscribe to events are gone too with these objects.
jswigart commentedon Nov 28, 2014
My new objects created in the scene register their callbacks when the new scene loads. I wouldn't consider it good practice to treat touch handling in a singleton like fashion
valyard commentedon Nov 29, 2014
Can you send me a little example of your setup?
jswigart commentedon Nov 29, 2014
Sure it will be Monday
pswl commentedon Dec 3, 2014
Confirm it in my 2D game project too. Unity 4.5.5f1, TouchScript 6.2 from assetstore.
I create game objects from prefabs, which contain SimplePangesture, TapGesture and Transformer2D in order to let user drag them to some location.
So, reloading same scene by "Restart level" or loading next level breaks "object panning" behavior, however I am still able to see clicks by attaching Touch Debugger prefab to the "broken" level.
And I cannot make these objects singletons, since they are to be destroyed in the game process.
valyard commentedon Dec 3, 2014
@pswl can you provide a project to test?
you can send it to v@lent.in if you don't want to post it publicly.
thanks.
pswl commentedon Dec 7, 2014
Spent some time on syntethic project to understand things better, but failed to reproduce the behavior and, thus, sending original project to your mailbox. Check it out, pls
pswl commentedon Dec 16, 2014
@valyard, do you have any news on my example?
Multiple Touch Managers in a scene are now handled correctly (issue #136
valyard commentedon Jan 22, 2015
This was happening because TouchManagerInstance objects somehow got created and saved to scenes out of Play Mode. You can open a scene and search for "m_Name: TouchManager Instance". Not sure how they came through into scenes.
pswl commentedon Jan 23, 2015
It is working as a charm now!
Thanks a lot!
Added singleton code from TouchManagerInstance to GestureManagerInsta…