So I want to make my code to where i can only make myTarget appear once and cant disappear after that. But that’s not what’s happening. Every time i press Q it appears then when i press Q again it disappears. I know i have to put in a if myTarget is active then… but i don’t know what to put in after that.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class inv : MonoBehaviour
{
public GameObject m_Target;
void Start()
{
m_Target.SetActive(false);
}
void Update ()
{
if ( Input.GetKeyDown(KeyCode.Q))
{
m_Target.SetActive(!m_Target.activeSelf);
}
}
}