Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

another Send message has no reciever

Discussion in 'Scripting' started by Rylux, Jan 12, 2015.

  1. Rylux

    Rylux

    Joined:
    Jan 12, 2015
    Posts:
    2
    Hi everyone, here's how I get the issue. I had a button from the new UI which I wanna use to quit the game. But instead of having a lot of inactive game objects (used to launch scripts) I wanted to put it in a other script attached to my main game object( a game object with DontDestroyOnLoad ), so I can use it in any scene without having to had another game object. The button has for function SendMessage() and I set my game object as asked. (I don't know if in the message section I must use "Quit"or Quit though) and I get the has no reciever error. I must be missing something but I can't see what? Can somebody help, please?
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Abandon SendMessage. Now that the EventSystem is live it really serves no purpose. Instead call the Quit function directly.
     
    Rylux likes this.
  3. Rylux

    Rylux

    Joined:
    Jan 12, 2015
    Posts:
    2
    I use the new UI Burton, it can't call directly the Quit fonction. I don't know about event system, though