Hi, i am stuck implementing the back button press to quit the unity 3D ARCamera. I have created new C# script with code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Quit : MonoBehaviour
{
public void Update()
{
if (Application.platform == RuntimePlatform.Android)
{
if (Input.GetKeyUp(KeyCode.Escape))
{
//quit application on return button
Application.Quit();
return;
}
}
}
}
I saw some old forum or answers from google telling that the script need to be add into ARCamera or any GameObject component. So i just follow their instruction but unfortunately the script is gone from the Inspector tab and also the GameObject missing from “hierarchy tab” after i export the Unity project into certain folder because i am working with Android Studio.
I am confused and i dont know what should i do to make the back button quits the Unity application ![]()


