Playmaker Forum

PlayMaker Updates & Downloads => Official Action Updates => Topic started by: Alex Chouls on August 06, 2011, 03:10:56 PM

Title: ApplicationQuit Action
Post by: Alex Chouls 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.
Title: Re: ApplicationQuit Action
Post by: Damian 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??
Title: Re: ApplicationQuit Action
Post by: Alex Chouls 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
Title: Re: ApplicationQuit Action
Post by: Damian 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 :-)
Title: Re: ApplicationQuit Action
Post by: qholmes on August 06, 2011, 10:28:38 PM
Sweeeeeet.

Q :D
Title: Re: ApplicationQuit Action
Post by: stigma on April 05, 2014, 04:05:15 AM
Hi,
I can't quit my game with this code.
Is my method is correct please ?
(http://www.maximages.fr/forums/3D/playmaker/applicationquit.png)
Thanks
Title: Re: ApplicationQuit Action
Post by: jeanfabre 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