Save Button state(if shown or hidden)
So i made a script and attached it to a cube (script at end) and then attached to cube and in the gameobject player4button i created a button dragged it and kept it hidden
Now it works as i want it to and shows button when the keep touches other cube , but the problem is i cant save the button state and it always is hidden , what i want is if the trigger happens , the button and i quit the game/scene and restart it then the button should be shown and not hidden i know there is a way to do it with Playerprefs but idk how so any help is appreciated
Script
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class DestroyObjectscript : MonoBehaviour { // Start is called before the first frame update public GameObject player4button;
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "cube")
{
player4button.gameObject.SetActive(true);
//Destroy(gameObject);
}
}
}
Your answer
Follow this Question
Related Questions
How do i add coins in my Save Total Coin, everytime i collect more coins in the game? 0 Answers
After following a save tutorial, it won't work! 0 Answers
Save and load player position in main scene 1 Answer
How to Reset Save Data 1 Answer
How To Save and Load player position using Serialization? 0 Answers