From a84f607323bea03e371261a3c3c396237a440797 Mon Sep 17 00:00:00 2001 From: Balex123 Date: Tue, 31 Jan 2023 10:47:36 +0100 Subject: [PATCH] Quitbutton done Working! --- Assets/Scenes/Main_Menu.unity | 40 ++++++++++++++++++++++++++- Assets/Scripts/Quitscript.cs | 12 ++++++++ Assets/Scripts/Quitscript.cs.meta | 11 ++++++++ UserSettings/EditorUserSettings.asset | 4 +-- 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 Assets/Scripts/Quitscript.cs create mode 100644 Assets/Scripts/Quitscript.cs.meta diff --git a/Assets/Scenes/Main_Menu.unity b/Assets/Scenes/Main_Menu.unity index cbe4a88..03d6f76 100644 --- a/Assets/Scenes/Main_Menu.unity +++ b/Assets/Scenes/Main_Menu.unity @@ -174,6 +174,7 @@ GameObject: - component: {fileID: 221552282} - component: {fileID: 221552281} - component: {fileID: 221552280} + - component: {fileID: 221552284} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -263,6 +264,18 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!114 &221552284 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 221552279} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7075d8cc44c60404c9498235097a7670, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1610526387 GameObject: m_ObjectHideFlags: 0 @@ -380,6 +393,7 @@ GameObject: - component: {fileID: 1779447996} - component: {fileID: 1779447995} - component: {fileID: 1779447994} + - component: {fileID: 1779447997} m_Layer: 5 m_Name: Quit m_TagString: Untagged @@ -450,7 +464,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1779447995} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 221552284} + m_TargetAssemblyTypeName: Quitscript, Assembly-CSharp + m_MethodName: QuitGame + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!114 &1779447995 MonoBehaviour: m_ObjectHideFlags: 0 @@ -489,6 +515,18 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1779447992} m_CullTransparentMesh: 1 +--- !u!114 &1779447997 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1779447992} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7075d8cc44c60404c9498235097a7670, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1989443924 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Quitscript.cs b/Assets/Scripts/Quitscript.cs new file mode 100644 index 0000000..b8b2d12 --- /dev/null +++ b/Assets/Scripts/Quitscript.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Quitscript : MonoBehaviour +{ + public void QuitGame() + { + Application.Quit(); + Debug.Log("Quit!"); + } +} diff --git a/Assets/Scripts/Quitscript.cs.meta b/Assets/Scripts/Quitscript.cs.meta new file mode 100644 index 0000000..78e8748 --- /dev/null +++ b/Assets/Scripts/Quitscript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7075d8cc44c60404c9498235097a7670 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index e884df4..9cec14d 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -9,10 +9,10 @@ EditorUserSettings: value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661 flags: 0 RecentlyUsedSceneGuid-1: - value: 50545254560458595a5e0e7748215d4442161e7e7b2e22342e2c4866b6b4376a + value: 02095251535050595d5e0f2311735c44124f1c2e7b7077667f7e4560b7b3306b flags: 0 RecentlyUsedSceneGuid-2: - value: 02095251535050595d5e0f2311735c44124f1c2e7b7077667f7e4560b7b3306b + value: 50545254560458595a5e0e7748215d4442161e7e7b2e22342e2c4866b6b4376a flags: 0 vcSharedLogLevel: value: 0d5e400f0650