- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.SceneManagement;
- public class Menu : MonoBehaviour
- {
- public AudioClip audioKlik;
- private AudioSource MediaPlayerKlik;
- // Method untuk memulai permainan
- void Start () {
- MediaPlayerKlik = gameObject.AddComponent<AudioSource>();
- MediaPlayerKlik.clip = audioKlik;
- }
- public void StartButton(string gamePlayScene)
- {
- SceneManager.LoadScene(gamePlayScene);
- MediaPlayerKlik.Play();
- }
- // Method untuk membuka scene credit
- public void CreditButton(string creditScene)
- {
- SceneManager.LoadScene(creditScene);
- MediaPlayerKlik.Play();
- }
- // Method untuk keluar dari game
- public void ExitGame()
- {
- #if UNITY_EDITOR
- UnityEditor.EditorApplication.isPlaying = false;
- #else
- Application.Quit();
- #endif
- MediaPlayerKlik.Play();
- }
- }
[text] Menu
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: