S
S
SkrinV2019-08-26 23:28:15
Unity
SkrinV, 2019-08-26 23:28:15

Error cs1525 with the term int, how to fix?

I made a code so that when the projectile hits the bot, an object appears in the bot that emits particles (from the unit), but in the end he wrote about the wrong term.
Here is the code itself:

using UnityEngine;
using System.Collection;
using System.Collection.Generic;

public class Died : MonoBehavour
{
    public GameObject snarad;
    public Animator animator;
    void Start { }
    void Update { }
    void OnCollisionEnter(Collision snarad)
    {
        State = CharState.fire;
    }
    private CharState State
    {
        get { return (CharState)animator.GetInteger("CharState"); }
        set { animator.SetInteger("State"(int), value); } //Пишет, что недопустимый термин int в выражении, как исправить?
    }
    public enum CharState { fire }
}

Can you help how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2019-08-27
@SkrinV

set { animator.SetInteger("State", (int)value); }
You are converting the input value value to an integer, and "State" is just a name, you don't need to touch it, especially in this way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question