Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

No touch callbacks after application. Loadlevel #136

Closed

Description

@jswigart

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
    Author

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

  2. jswigart commented on Nov 17, 2014

    @jswigart
    Author

    Also, using win7,mobile,mouse

  3. neciu commented on Nov 25, 2014

    @neciu

    Confirmed.

  4. valyard commented on Nov 28, 2014

    @valyard
    Contributor

    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
    Author

    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
    Author

    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
    Contributor

    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
    Author

    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
    Contributor

    Can you send me a little example of your setup?

  10. jswigart commented on Nov 29, 2014

    @jswigart
    Author

    Sure it will be Monday

  11. pswl commented on Dec 3, 2014

    @pswl

    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
    Contributor

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

  13. pswl commented on Dec 7, 2014

    @pswl

    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

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

  15. valyard commented on Jan 22, 2015

    @valyard
    Contributor

    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.

  16. pswl commented on Jan 23, 2015

    @pswl

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

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