- Home /
How can i make enum choice to not pause the game ?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Animations : MonoBehaviour
{
public enum AnimatorStates
{
WALK, RUN, IDLE
}
public AnimatorStates animatorStates;
private Animator _anim;
void Awake()
{
_anim = GetComponent<Animator>();
}
private void Start()
{
}
public void PlayState(AnimatorStates state)
{
string animName = string.Empty;
switch (state)
{
case AnimatorStates.WALK:
animName = "Walk";
break;
case AnimatorStates.RUN:
animName = "Run";
break;
}
if (_anim == null)
_anim = GetComponent<Animator>();
_anim.Play(animName);
}
void Update()
{
PlayState(animatorStates);
}
}
While the game is running and i click on the animatorStates in the Inspector while the game is running the game is pause until i select a state. Is there any way to make that the game will keep running when i click on the enum menu in the inspector the animatorStates ?
In the PlayerSettings (you can access it via Edit->Project Settings->PlayerSettings or in the build settings you can see PlayerSettings button) try to enable Run in background and see if it works.
Your answer
Follow this Question
Related Questions
Why when creating new animator controller for the character the character is not walking right ? 0 Answers
How can i Instantiate on the terrain from left to right ? 0 Answers
Why the tile map scripts take almost all the cpu usage ? cpu usage is getting to 99% at times 1 Answer
How can i rotate object by pressing on key R and keep object facing to me my self ? 0 Answers
How can i spawn new gameobjects to be inside the terrain area ? 2 Answers