Search Unity

animation.SetBool

Discussion in 'Animation' started by Immortaldan10, Feb 26, 2021.

  1. Immortaldan10

    Immortaldan10

    Joined:
    Feb 25, 2021
    Posts:
    2
    im making a game and ran into a problem with this script:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class axde : MonoBehaviour
    {
    public Animation anim;

    void Start()
    {
    anim = GetComponent<Animation>();
    }

    void Update()
    {
    if (Input.GetButtonDown("Fire1"))
    {
    Debug.Log("fire");
    anim.SetBool("fire", true);
    }

    }

    }

    im getting this error message
    Assets\axde.cs(19,18): error CS1061: 'Animation' does not contain a definition for 'setBool' and no accessible extension method 'setBool' accepting a first argument of type 'Animation' could be found (are you missing a using directive or an assembly reference?)
     
  2. Immortaldan10

    Immortaldan10

    Joined:
    Feb 25, 2021
    Posts:
    2
    It was public Animator not Animation