Accessing a public Bool from a Ui Button?

Hey, i got a script which looks like this:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;

#if UNITY_EDITOR
using UnityEditor;
#pragma warning disable 0219
#pragma warning disable 0162
#pragma warning disable 0414
#endif

public class boolz : MonoBehaviour {
#if UNITY_EDITOR
	
	// states
	public bool editorIsLoading;
	public bool erase;
	private int isRotated;
	private int isRotatedH;
	private bool is2D;
	private bool isOrtho;
	public bool canBuild;
	private bool isCurrentStatic;
	private bool isCamGridMoving;
	private bool isBuildingTC;
	private bool isContinuesBuild;
	private bool isSortingByNameEnabled;

	public bool isBuildingMass;
	private bool isMouseDown;
	private bool isInTopView;
//and so on...

so what i am trying to do is for example activating the “public bool erase;” for example via an UI button. so using the unity event system (that on click() thing from the Button Component) but i can not find the bool in the drop down menu.
next question after that would be how can i prevent that two bools are activated, for example “public bool erase;” and “public bool canBuild;” should’nt be active at the same time

You cannot use instance variable directly, you can pass a static value like either true or false if your method looks like this:

    public void MyMethod(bool value);

But that is not what you want.

You need to pass the script as parameter:

public void MyMethod(boolz script){
     script. editorIsLoading = ! script. editorIsLoading;
}

this would switch the value on/off.

So add a script with that method to an object, drag the object to the button listener slot. Then look for the method. You now have a boolz slot showing up. Drag the bool component you want to use in that method.