Animation problems

I have had a lot of trouble getting this easy thing to work. Can someone tell me what i am doing wrong since i have absolutely no clue.

I want my animation to change speed when i hit the 2D collider called: “Ground [UNREACHABLE]”

I am pretty new to coding so if you now to answer, try to explain it to me very carefully! :slight_smile:
The script i am using (c#):

using UnityEngine;
using System.Collections;

public class Screen_Fade : MonoBehaviour
{
public Animation anim;

void Start()
{
    anim = GetComponent<Animation>();
    foreach (AnimationState state in anim)
    {
        state.speed = 0.05f;
    }

}
void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.name.Equals("Ground [UNREACHABLE]"))

    {
        state.speed = 1f;
    }
}

}

you are changing “state”, state is not a variable in the scope of your OnCollisionEnter2D() method. If you want to change the animation state speeds, you can use the same loop that you use in the start method:

foreach (AnimationState state in anim)
    {
        state.speed = 1.0F;
    }

That should do it