I´ve been dealing with an extremly frustrating problem for 2 weeks. The forum couldn´t help yet, so you guys are my last resort.
I have a AR-scene with several canvas, that are supposed to be invisible when the scene was loaded.
This script is used to achieve that:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ToggleMenu : MonoBehaviour
{
// Canvas that appears when the user clicks on the cube
public Canvas fountaininfo;
// Switch for visible / not visible setting
public bool fountainswitch;
// Button, that closes the canvas / makes it invisible again
public Button fountainclose;
// ###################
// ## Settings at the start ##
// ###################
void Start()
{
// Assinging the Canvas to this variable
fountaininfo = fountaininfo.GetComponent<Canvas> ();
// visibility setting at the start
fountaininfo.enabled = false;
// setting of the switch
fountainswitch = false;
}
// #######################################
// ## Function, that makes the button visible on click ##
// #######################################
private void OnMouseDown()
{
if (fountainswitch == false)
fountaininfo.enabled = true;
fountainswitch = true;
}
// ################################
// ## Function that closes the canvas again ##
// ################################
public void fountainclose_Press()
{
fountaininfo.enabled = false;
fountainswitch = false;
}
}
However, when the scene has loaded, half of the total number of canvas are visible - although I turned them off in the script - what am I missing here? - I put plenty of hours into finding a solution but I just cant find it