playMaker

Author Topic: ApplicationQuit Action  (Read 4520 times)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
ApplicationQuit Action
« on: August 06, 2011, 12: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, 12:16:11 PM by alexchouls »

Damian

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 188
    • View Profile
    • Permaximum Betty
Re: ApplicationQuit Action
« Reply #1 on: August 06, 2011, 12: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, 12:34:02 PM by Damian »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: ApplicationQuit Action
« Reply #2 on: August 06, 2011, 12: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
    • View Profile
    • Permaximum Betty
Re: ApplicationQuit Action
« Reply #3 on: August 06, 2011, 12: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, 12:57:17 PM by Damian »

qholmes

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

Q :D

stigma

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
    • Maximages
Re: ApplicationQuit Action
« Reply #5 on: April 05, 2014, 01:05:15 AM »
Hi,
I can't quit my game with this code.
Is my method is correct please ?

Thanks
Myst-Like WIP :  Cutish

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: ApplicationQuit Action
« Reply #6 on: April 07, 2014, 03: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