calling a function

In a script I am working on, I made a function to sort some variables, but nothing happens when I run the game, so I thought it might be that nothing called the function.

What should I write to call a function one time every time a bool turns from false to true?

I have tried to search google, the forums, the wiki, but I cant find anything

Thanks in advance:)

Is this in C# or JS?

I’d say something like.

Update()
{
  bool somethingChanged = false;

  // boolean becomes true
  if(whatever_makes_true_happened)
  {
    myBoolean = true;
    somethingChanged = true;
  }

  if(somethingChanged)
  {
    MyFunction()
  }
}

About Scripting, at the top of the Scripting Forum contains this link:

http://forum.unity3d.com/threads/34015-Newbie-guide-to-Unity-Javascript-(long)

It will tell you everything you need to know about functions and booleans.

Its in javascript, forgott to tell:P

is there any way to do this without using update, becouse the update function fires of every frame and I am trying to make it fire of one time

Maybe something like this

//not actual code
static var PowerLevel = 0;
var somethingHappened = false;

//another script changes the power level

<thing that fires of function Something when somethingHappened turns true>

function Something () {
if (points >= 9000) {
Debug.Log ("Its over 9000!!!");
}
}

I have read it before and it is a great tutorial thanks a lot for making it:smile:, but I cant find exactly what I am looking for
Where should I tell the script to call the function (without using update)?

works now:smile: thanks a lot:)