Hi, I need help for my unity project about blend trees and jumping codes. I implemented a idle and walking blend tree and it’s works in preview, but when the scene is playing; only the idle animation plays and the player slides. For the jumping, I’ve tried multiple tutorials on jumping and for some reason all of them do not work on my project, so I deleted them all. I’m really don’t know want to do next or how to fix it?
Welcome to the community, @Yasmine_Benjamin
How did you implement the blend tree and jump? It will help us to see what you did - or maybe did not do.
The warning is because you deleted the AnimatorandMovementScript.cs
but it is still attached to a game object. The error is a Unity error and may fix itself if you restart Unity (or perhaps even if you remove the delete script reference from the game object)
i delete and copy paste but its still saying the same issue. ill try and restart it
it didnt work either
it also has this error but my code is correct
What does the script look like?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Script : MonoBehaviour
{
PlayerInput PlayerInput;
CharacterController characterController;
Vector2 currentMovementInput;
Vector3 currentMovement;
bool isMovementPressed;
void Awake()
{
PlayerInput = new PlayerInput();
characterController = GetComponent<CharacterController>();
PlayerInput.CharacterControls.Move.started += context =>
{
currentMovementInput = context.ReadValue<Vector2>();
currentMovement.x = currentMovementInput.x;
currentMovement.y = currentMovementInput.y;
isMovementPressed = currentMovementInput.x != 0 || currentMovementInput.y != 0;
};
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
characterController.Move(currentMovement);
}
void OnEnable()
{
PlayerInput.CharacterControls.Enable();
}
void OnDisable()
{
PlayerInput.CharacterControls.Disable();
}
}
Is this in a file called AnimatorandMovementScript.cs
? If so, that is the problem. This class is called Script
. The class name must match the file name. Rename the class to AnimatorandMovementScript
give me a sec
got it. thank you, I’ll come to you when I need help again. Still a unity beginner
No
Do you want to meet on discord or google meet? I feel like it’s better to show you my problem
Earlier you said you got it. What are you still having problems with?
I’ve restarting doing the project. I’m using a third person starter asset and updating it from there
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.