Я только начал добавлять анимацию, когда птица летит (после нажатия клавиши пробела), и, как я уже упоминал, она будет запускаться только после нажатия клавиши пробела, поэтому я использовал логическое значение в переход, и использовал следующий сценарий, чтобы связать анимацию с реальным объектом.
это сценарий, который я использовал
Код: Выделить всё
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BirdScript : MonoBehaviour
{
// inaisly the script is not aware of the things we added into the object
//we need to make those conctions using a refrance
public Rigidbody2D BirdRigidBody;
public float flapStentgh;
public LogicScript logic;
public bool AliveBird = true;
public Animator BirdAnimator;
//after making the varible go back to unity and drag the rigid body in
// Start is called before the first frame update
void Start()
{
logic = GameObject.FindGameObjectWithTag("logic").GetComponent();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space)==true &&AliveBird) {
BirdRigidBody.velocity = Vector2.up * flapStentgh;
BirdAnimator.SetBool("flapping", true);
}
if (transform.position.y
Подробнее здесь: [url]https://stackoverflow.com/questions/78688046/making-my-floppy-bird-jump-animations-make-my-game-poses-in-unity[/url]