playMaker

Author Topic: ApplicationQuit Action  (Read 10791 times)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
ApplicationQuit Action
« on: August 06, 2011, 03:10:56 PM »
EDIT: Just noticed Jean posted the same action ages ago!
http://hutonggames.com/playmakerforum/index.php?topic=113.0

Very simple, but useful action...

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Application")]
[Tooltip("Quits the player application.")]
public class ApplicationQuit : FsmStateAction
{
public override void Reset()
{
}

public override void OnEnter()
{
Application.Quit();

Finish();
}
}
}

You should be able to make any simple Unity command into an action by hacking this example.

Just change the action class name and the command in OnEnter.
« Last Edit: August 06, 2011, 03:16:11 PM by alexchouls »

Damian

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 188
    • Permaximum Betty
Re: ApplicationQuit Action
« Reply #1 on: August 06, 2011, 03:15:58 PM »
Thanks.. you are great :-)

But it did not work.

Code: [Select]
Assets/PlayMaker/Actions/ApplicationQuit.cs(13,25): error CS0103: The name `Application' does not exist in the current contextMaybe its an other name when using CS??
« Last Edit: August 06, 2011, 03:34:02 PM by Damian »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: ApplicationQuit Action
« Reply #2 on: August 06, 2011, 03:45:14 PM »
Did you copy/paste, or download the cs file. Make sure you have using UnityEngine; at the top.

Also there are some usage notes here:
http://unity3d.com/support/documentation/ScriptReference/Application.Quit.html

Damian

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 188
    • Permaximum Betty
Re: ApplicationQuit Action
« Reply #3 on: August 06, 2011, 03:51:11 PM »
Did you copy/paste, or download the cs file. Make sure you have using UnityEngine; at the top.

Also there are some usage notes here:
http://unity3d.com/support/documentation/ScriptReference/Application.Quit.html

Yes I did copy and past and you are right I did missed the top raw.. ::)

UPDATE:
I did try it out and it work just fine.
Thanks for the great support.
Also to show me how to make simple action script :-)
« Last Edit: August 06, 2011, 03:57:17 PM by Damian »

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: ApplicationQuit Action
« Reply #4 on: August 06, 2011, 10:28:38 PM »
Sweeeeeet.

Q :D

stigma

  • Full Member
  • ***
  • Posts: 176
Re: ApplicationQuit Action
« Reply #5 on: April 05, 2014, 04:05:15 AM »
Hi,
I can't quit my game with this code.
Is my method is correct please ?

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ApplicationQuit Action
« Reply #6 on: April 07, 2014, 06:51:29 AM »
Hi

-- you can't quit your own app on IOS.
-- else, MOUSE DOWN transition may not be called.

 Can you give a bit more context about your published platform etc.

bye,

 Jean