FixedUpdate inside an Input Event

Hey, just a quick question. I want to know how to put a FixedUpdate inside an Input.GetMouseButtonUp event.

I want to move the main camera when I’ve clicked on a game object in C#

The following code is how the camera moves :

void FixedUpdate() {
        float newPositiony = Mathf.SmoothDamp(transform.position.y, target.position.y, ref yVelocity, smoothTime);
        transform.position = new Vector3(transform.position.x, newPositiony, transform.position.z);

You’ve got your wires a bit crossed here, Martin. FixedUpdate is an function that is called every time Unity updates the physics in your scene. Input.GetMouseButtonUp is an attribute that you can read to see if the mouse button was released this frame. Talking about putting a function within an attribute is meaningless.

What you probably want to do is:

void Update() //this is called every frame
{
  if (Input.GetMouseButtonUp(0)) //the left mouse button was released
  {
    //do something
  }
}