Script only works onetime


I tried to create a script which toggles a GameObject (in this case an information text) on or off:

using UnityEngine;
using System.Collections;

public class toggleInformation : MonoBehaviour {

	public GameObject ObjectToToggle;
	public bool active;

	void Start() {
		active = true;

	public void toggle() {
		Debug.Log ("toggle");
		if (active = true) {
			active = false;
		} else if (active = false) {
			active = true;
		} else {
			Debug.Log ("Error: active neither true nor false");

Unfortunately it only works to toggle off the GameObject (default: it is turned on when starting the game).
Console shows only one “toggle” even though I pressed the button several times (button executes the script).

Any ideas? :-/

Thank you!

Is your script attached to ObjectToToggle? If it is, there is problem, because when ObjectToToggle is inactive, all scripts attached to it will be inactive too.
My suggestion is to attach script to other gameObject.