Skip to content

Instantly share code, notes, and snippets.

@JonathanYin
Created July 17, 2017 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonathanYin/fc9cc3dd2abc933eda35df4d10deb270 to your computer and use it in GitHub Desktop.
Save JonathanYin/fc9cc3dd2abc933eda35df4d10deb270 to your computer and use it in GitHub Desktop.
using System.Collections;
using UnityEngine;
public class Note : MonoBehaviour
{
private Texture pic1;
public GameObject panel;
private float open = 0f;
public bool toggleBool;
public GameObject player;
public GameObject player2;
private void Start()
{
//pic1 = (Texture)Resources.Load("pic1");
}
void OnGUI()
{
if (player && player2) {
if (player.transform.position.x < -1.25 && player2.transform.position.x < -1.25)
{
if (GUI.Button(new Rect(150, 375, 20, 20), "?"))
{
toggleBool = !toggleBool;
panel.SetActive(toggleBool);
//Application.OpenURL("Assets\\Resources\\pic1");
//Object img;
//img = Resources.Load("pic1");
//GameObject instance = Instantiate(Resources.Load("pic1", typeof(GameObject))) as GameObject;
}
}
}
}
}
@JonathanYin
Copy link
Author

JonathanYin commented Jul 17, 2017

Due to a bug that happened with how the bombs in my game were exploding, I decided to add a warning for players new to my game about how the bug works. This script would create a button that, when pressed, would toggle on and off a canvas which held two images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment