Simple way to change sprites with animations?

I have a player sprite with its own 2d animation. But what I would like to do is that everytime you click on the sprite it changes to the next sprite or prefab? I have 4 sprites in total all of them as a prefab Except for the starting sprite! So once you cycle through the sprites it goes back to the beginning sprite again! I’ve tried using a variable method but if I’m being honest I dont seem to understand c# very well!

Hello @mike_97 ,
Could you share your current implementation, so we have some base to start from?
Thanks!

Well I have 4 scenes and 2 of them are used with the player the first scene is the main menu where you would choose the sprite by clicking on the player sprite. The game is a 2d flappy bird style game theres 4 sprites with their own animators!

Hey I figured It out!

I figured it out but now there’s another problem the sprite that I choose from revert to the default sprite when I switch the scene! Like in the pictures.

6730264--774652--T FLY - MenuScene - Android - Unity 2019.4.8f1 Personal DX11 2021-01-15 4_51_46 PM.png
6730264--774655--T FLY - MenuScene - Android - Unity 2019.4.8f1 Personal DX11 2021-01-15 4_52_10 PM.png

Great that you figured out your issue.
I don’t quite understand your new issue though, could you elaborate?

Well I can pick out of 4 sprites in my starting menu scene, but when I transition to my game scene its back to the first sprite.

Without any code showing what you are doing, it is very tricky to narrow down what goes wrong

Here is the code I use for changing sprites.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Sprites : MonoBehaviour
{
private Animator anim;
float setsprite = 0f;
// Start is called before the first frame update
void Start()
{
anim = GetComponent();
}

void Update()
{
if (setsprite == 4)
{
setsprite = 0;
}
anim.SetFloat(“Trutet”, setsprite);
}

// Update is called once per frame
void OnMouseDown()
{
setsprite += 1;
}
}

If you are using SceneManager.LoadScene(); to switch scene with the default call, the current scene is unloaded and the next scene is then loaded in. This means that the objects that lived in the first scene are destroyed and their data does not exist anymore.
There are different ways to attack this problem, but I would suggest you to have a look at one of our beginner tutorials to get a good base understanding on how to work with Unity. This, and a lot of other pitfalls are covered in these tutorials.
https://learn.unity.com/