GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — No touch callbacks after application. Loadlevel · Issue #136 · TouchScript/TouchScript

No touch callbacks after application. Loadlevel #136

New issue
Copy link
New issue
Copy link
Closed
Closed
No touch callbacks after application. Loadlevel#136
Copy link

Description

@jswigart
jswigart
opened on Nov 17, 2014
Issue body actions

I'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.

Activity

  1. jswigart commented on Nov 17, 2014

    @jswigart
    jswigart
    on Nov 17, 2014
    Author
    More actions

    FYI I've verified that the callback registration happens each time the scene is loaded.

  2. jswigart commented on Nov 17, 2014

    @jswigart
    jswigart
    on Nov 17, 2014
    Author
    More actions

    Also, using win7,mobile,mouse

  3. neciu commented on Nov 25, 2014

    @neciu
    neciu
    on Nov 25, 2014
    More actions

    Confirmed.

  4. valyard commented on Nov 28, 2014

    @valyard
    valyard
    on Nov 28, 2014
    Contributor
    More actions

    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.

  5. jswigart commented on Nov 28, 2014

    @jswigart
    jswigart
    on Nov 28, 2014
    Author
    More actions

    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.

  6. jswigart commented on Nov 28, 2014

    @jswigart
    jswigart
    on Nov 28, 2014
    Author
    More actions

    Btw why would you mark that not destroy on load? Is anything that registers touch callbacks intended to be persistent?

  7. valyard commented on Nov 28, 2014

    @valyard
    valyard
    on Nov 28, 2014
    Contributor
    More actions

    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.

  8. jswigart commented on Nov 28, 2014

    @jswigart
    jswigart
    on Nov 28, 2014
    Author
    More actions

    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

  9. valyard commented on Nov 29, 2014

    @valyard
    valyard
    on Nov 29, 2014
    Contributor
    More actions

    Can you send me a little example of your setup?

  10. jswigart commented on Nov 29, 2014

    @jswigart
    jswigart
    on Nov 29, 2014
    Author
    More actions

    Sure it will be Monday

  11. pswl commented on Dec 3, 2014

    @pswl
    pswl
    on Dec 3, 2014
    More actions

    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.

  12. valyard commented on Dec 3, 2014

    @valyard
    valyard
    on Dec 3, 2014
    Contributor
    More actions

    @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.

  13. pswl commented on Dec 7, 2014

    @pswl
    pswl
    on Dec 7, 2014
    More actions

    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

  14. pswl commented on Dec 16, 2014

    @pswl
    pswl
    on Dec 16, 2014
    More actions

    @valyard, do you have any news on my example?

  15. valyard
    added a commit that references this issue on Jan 22, 2015

    Multiple Touch Managers in a scene are now handled correctly (issue #136

    d30b0ac
  16. valyard commented on Jan 22, 2015

    @valyard
    valyard
    on Jan 22, 2015
    Contributor
    More actions

    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.

  17. valyard
    closed this as completedon Jan 22, 2015
  18. pswl commented on Jan 23, 2015

    @pswl
    pswl
    on Jan 23, 2015
    More actions

    It is working as a charm now!
    Thanks a lot!

  19. valyard
    added a commit that references this issue on Nov 30, 2015

    Added singleton code from TouchManagerInstance to GestureManagerInsta…

    f5c5775
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.