Didn`t find animator! UnityEngine.Debug:LogError(Object) BirdMovement:Start() (at Assets/BirdMovement.cs:19)

using UnityEngine;
using System.Collections;

public class BirdMovement : MonoBehaviour {

Vector3 velocity = Vector3.zero;
public float flapSpeed = 50f;
public float forwardSpeed = 1f; 

bool didFlap = false;

Animator animator;

// Use this for initialization
void Start () {
	transform.GetComponentInChildren<Animator>();**ERROR**

		if (animator == null); { **ERROR**
		Debug.LogError("Didn`t find animator!");**ERROR**
	}

}

//Do Graphic & Input updates here
void Update() {

	if(Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)) {
		didFlap = true;

	}
}

// Do physics engine updates here
void FixedUpdate () {
	gameObject.GetComponent<Rigidbody2D>().AddForce(Vector2.right * forwardSpeed);

	if(didFlap) {
		gameObject.GetComponent<Rigidbody2D>().AddForce(Vector2.up * flapSpeed);
		Animator.SetTrigger("DoFlap");**ERROR**

		didFlap = false;
	}

	if(gameObject.GetComponent<Rigidbody2D>().velocity.y >0) {
		transform.rotation = Quaternion.Euler(0, 0, 0);
	}

	if(gameObject.GetComponent<Rigidbody2D>().velocity.y >0) {
		float angle = Mathf.Lerp(0, -25, -gameObject.GetComponent<Rigidbody2D>().velocity.y / 2f);
		transform.rotation = Quaternion.Euler(0, 0, angle);
	}

}

}

Hey, @Lenin1337.

The variable animator is null because it is not assigned when calling transform.GetComponentInChildren< Animator >() in the Start function. Another problem is that there is a semicolon after the if-statement that checks if animator is null.

The Start function should now be like this:

void Start()
{
	// Assign animator to the component Animator from its children.
	animator = transform.GetComponentInChildren< Animator >();
	
	if( animator == null )
	{ Debug.LogError( "Unable to find Animator!" ); }
}