GeezerVison is showing github.com — No touch callbacks after application. Loadlevel · Issue #136 · TouchScript/TouchScript
No touch callbacks after application. Loadlevel #136DescriptionI'm registering callbacks with TouchManager. Instance. TouchesBegan, Touches ended, etc.
After a call to Application. LoadLevel, these callbacks stop working. On latest code revisions as of today. Activityjswigart commented on Nov 17, 2014 FYI I've verified that the callback registration happens each time the scene is loaded. jswigart commented on Nov 17, 2014 Also, using win7,mobile,mouse neciu commented on Nov 25, 2014 valyard commented on Nov 28, 2014 Can you provide an example?
I'm testing with Examples.scene.
Added this script on an empty GameObject:
void Awake () {
DontDestroyOnLoad(gameObject);
TouchManager.Instance.TouchesBegan += (sender, e) => Debug.Log ("TOUCH!!!");
}
I'm getting "TOUCH!!!" messages even after changing scenes. jswigart commented on 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 commented on Nov 28, 2014 Btw why would you mark that not destroy on load? Is anything that registers touch callbacks intended to be persistent? valyard commented on 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 commented on 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 commented on Nov 29, 2014 Can you send me a little example of your setup? jswigart commented on Nov 29, 2014 pswl commented on 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 commented on Dec 3, 2014 @pswl can you provide a project to test?
you can send it to [email protected] if you don't want to post it publicly.
thanks. pswl commented on 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 commented on Dec 16, 2014 @valyard, do you have any news on my example? valyard commented on 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 commented on Jan 23, 2015 It is working as a charm now!
Thanks a lot!
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|