- Home /
Question by
gyenesmilan2004 · Aug 25, 2019 at 06:51 PM ·
deletefolderart
I deleted my character
when i got it back he couldn't move,what can i do? I have another problem,the script error:Type exepected Here is the script:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerController : MonoBehaviour {
public float moveSpeed;
private Animator anim;
private bool playerMoving;
private Vector2 lastMove;
// Start is called before the first frame update
void Start() {
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
playerMoving = false;
if(Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < -0.5f )
{
transform.Translate (new Vector3 (Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f , 0f));
playerMoving = true;
lastMove = new Vector2 (Input.GetAxisRaw("Horizontal"), 0f);
}
if(Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f )
{
transform.Translate (new Vector3 (0f,Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
playerMoving = true;
lastMove = new Vector2(0f, Input.GetAxisRaw("Vertical"));
}
anim.SetFloat("MoveX", Input.GetAxisRaw("Horizontal"));
anim.SetFloat("MoveY", Input.GetAxisRaw("Vertical"));
anim.SetBool("PlayerMoving", playerMoving);
anim.SetFloat ("LastMoveX", lastMove.x);
anim.SetFloat ("LastMoveY", lastMove.y);
}
Comment
tell us where there error appears and format the code using the 101 button
i have error in the player controller scipt
pleae share the full error, and where it appears, i cant see anything wrong
Answer by YetAnotherKen · Aug 25, 2019 at 10:01 PM
Did you use Destroy on the character's GameObject?
Your answer
Follow this Question
Related Questions
Delete Folder? 2 Answers
File.Delete problems with Application.CaptureScreenshot 2 Answers
Delete prefab in resource folder 0 Answers
delete a cube with particles 0 Answers