Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Toggle boxes not dealing with multiple booleans in a script

Discussion in 'UGUI & TextMesh Pro' started by Tempy111, Apr 13, 2022.

  1. Tempy111

    Tempy111

    Joined:
    Apr 26, 2021
    Posts:
    32
    It's a bit confusing but I've got Two toggle boxes. Okay, that bits not confusing..
    anyway, I have one script which has two public booleans declared:
    public bool Sett_SH and public bool Sett_MA. both start off set as false. now, when i try to use the 'on value change (Boolean)' option on the Inspector to set which boolean the toogle box controls, when i select the script which contains the booleans, it always picks the last one set (in this case, Sett_MA). It doesn't seam to allow me to tell it if i want to set MA or SH.

    It seams a bit weird but can you only use that to set one boolean per script? the booleans are public as they are called from other scripts.
     
  2. Tempy111

    Tempy111

    Joined:
    Apr 26, 2021
    Posts:
    32
    Okay.. figured it out.. manual isn't written as well as i would like so checked up with other stuff and finally found out that saying it wants a boolean is a load of rubbish, it just wants a function like everything else.. so I put in a couple of functions for it.