Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

I cannot understand what is the error in the code

Discussion in 'General Discussion' started by Frotzhen, Feb 14, 2021.

?

I cannot understand what is the error in the code

  1. Cs

    1 vote(s)
    100.0%
  2. CS1061

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. Frotzhen

    Frotzhen

    Joined:
    Feb 13, 2021
    Posts:
    2
    Assets\GunContoller.cs(20,15): error CS1061: 'Animator' does not contain a definition for 'SerTrigger' and no accessible extension method 'SerTrigger' accepting a first argument of type 'Animator' could be found (are you missing a using directive or an assembly reference?)
    Please help me

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

    public class GunContoller : MonoBehaviour
    {

    Animator m_animator;
    // Start is called before the first frame update
    void Start()
    {
    m_animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
    if (Input.GetMouseButton(0)) {

    m_animator.SerTrigger("name");
    }
    }
    }
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,996
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,325
    There's no "Ser Trigger" in animatorcontroller. You made a typo. Correct spelling is SetTrigger.
     
    Joe-Censored and Ryiah like this.
  4. Frotzhen

    Frotzhen

    Joined:
    Feb 13, 2021
    Posts:
    2
    Thanks i finded