#```using System.Collections;

1 messages · Page 1 of 1 (latest)

dull nimbus
#

I don't see a funciton in here named HandleAllMovement - it's possible you keep renaming your methods out from under yourself

tropic kelp
#

yeah i dont understand the errors at all is it oke if i send all the scripts that keeps involving with the error

dull nimbus
#

Mmm, probably better if we help you understand the errors

#

We want to teach you how to fish, ya know?

tropic kelp
#

haha oke

dull nimbus
#

What errors are confusing you right now?

tropic kelp
#

Assets\Scripts\PlayerManager.cs(23,22): error CS1061: 'InputManager' does not contain a definition for 'HandleAllInputs' and no accessible extension method 'HandleAllInputs' accepting a first argument of type 'InputManager' could be found (are you missing a using directive or an assembly reference?)

Assets\Scripts\PlayerManager.cs(28,26): error CS1061: 'PlayerLocomotion' does not contain a definition for 'HandleAllMovement' and no accessible extension method 'HandleAllMovement' accepting a first argument of type 'PlayerLocomotion' could be found (are you missing a using directive or an assembly reference?)

using System.Collections.Generic;
using UnityEngine;


public class PlayerManager : MonoBehaviour


{
    InputManager inputManager;
    CameraManager cameraManager;
    PlayerLocomotion playerLocomotion;

    private void Awake()
    {
        inputManager = GetComponent<InputManager>();
        cameraManager = FindObjectOfType<CameraManager>();
        playerLocomotion = GetComponent<PlayerLocomotion>();
    }

    public void HandleAllInputs()
    {
        inputManager.HandleAllInputs();
    }

    private void FixedUpdate()
    {
        playerLocomotion.HandleAllMovement();
    }

    private void LateUpdate()
    {
        cameraManager.HandleAllCameraMovement();
    }
}
#

but when i try to fix it i get other errors and if i fix those i get these one back

dull nimbus
#

Do you understand what the error means when it says, for example, 'InputManager' does not contain a definition for 'HandleAllInputs'?

tropic kelp
#

not realy i just started 4 days ago

dull nimbus
#

haha okay, well welcome, and understanding that is pretty important

#

the wording might feel awkward or whatever, but it's often very particular, and you'll catch onto it with experience

#

When the parser sees a method name like HandleAllInputs, it looks at the object you're using and tries to find a method name called HandleAllInputs, but right now, it looks like there is no such method with that name

tropic kelp
#

oke so how do i fix it

dull nimbus
#

In that class, as you've posted, there is a HandleInputs, but that name is different from HandleAllInputs, so just make sure those names match (assuming that those are supposed to be the same thing)

ripe oxide
#

Auto complete should have prevented this unless they've explicitly typed the unavailable method. Maybe the IDE isn't configured.

tropic kelp
#

so i have to change all the HandleAllInputs in HandleInputs

#

yeah i dont know what IDE im using

dull nimbus
#

I think there's something to be said for the exercise of programming without those guardrails 🙂

#

But the training wheels can also be nice

#

@tropic kelp Basically, you told it to use something called HandleInputs, but you never said what HandleInputs is

#

and it seems like you meant to tell it to use the thing you called HandleAllInputs

tropic kelp
#

eehh how can i give it an definition

#

i gave it an definition in my inputmanager script but now i am stuck with this one

Assets\Scripts\PlayerManager.cs(28,26): error CS1061: 'PlayerLocomotion' does not contain a definition for 'HandleAllMovement' and no accessible extension method 'HandleAllMovement' accepting a first argument of type 'PlayerLocomotion' could be found (are you missing a using directive or an assembly reference?)

dull nimbus
#

So, read the message over again - you said that you put it inside InputManager, but the parser isn't saying that it's looking in InputManager for it, it's looking inside something else - where is it looking? (The error message says where, and I want you to identify it)

tropic kelp
#

PlayerManager.cs(28,26)

#

can i send my inputmanager script

dull nimbus
#

Well, just to be clear - you're trying to tell the parser to call HandleAllMovements, and you put it in InputManager, but you're telling to look in PlayerManager - does that make sense?

tropic kelp
#

no

dull nimbus
#

which part of that is unclear?

tropic kelp
#

everything

dull nimbus
#

I don't really know to help you if you can't be more specific about what's confusing

tropic kelp
#

i dont know how to fix the erros

#

errors

dull nimbus
#

To fix them, you really need to understand what they're even telling you

tropic kelp
dull nimbus
#

It's gonna fuck you over in the longrun if you just try to guess until it works

tropic kelp
#

yeah but i worked on this for hours and i dont want to lose my progress

dull nimbus
#

I understand

tropic kelp
#

i had to write all of his scripts over and that took me hours and now i got it and i get errors

dull nimbus
#

you're not gonna lose your progress

#

you're just not gonna learn anything if you guess your way through everything

#

and if you're not learning anything, you're just gonna waste your own time

tropic kelp
#

i learned how to animate in unity so i did learn something

dull nimbus
#

yeah, I understand

#

Just look back over this error and try to understand what it's trying to say:

'PlayerLocomotion' does not contain a definition for 'HandleAllMovement`
#

like, this is literally exactly the "error" that you need to fix, and it'll be very easy to fix when you understand what it's trying to say

tropic kelp
#

yeah but do you think you can fix it for me cause i dont understand anyting right know

dull nimbus
#

I can but I don't want to

#

All I want to do is help you understand the message, so if you have any questions about the error message, let me know

tropic kelp
#

cant you just explain it to me

dull nimbus
tropic kelp
#

can you do it in babysteps

dull nimbus
#

Okay, what does this error mean:
'PlayerLocomotion' does not contain a definition for 'HandleAllMovement?

tropic kelp
#

i have to make a definition for playerlocomotion in the playermanager script

dull nimbus
#

Yeah, that's one thing that you could do - do you know how to do that?

tropic kelp
#

no

dull nimbus
#

Okay, so when we talk about a "definition" for something, it means that you tell a class what it means to, for example, "HandleMovement". So, for example, you have this below:

public class PlayerLocomotion : MonoBehaviour
{
    // ... 
    public void HandleMovement(Vector2 input)
    {
        Vector3 moveDirection = (cameraTransform.forward * input.y + cameraTransform.right * input.x).normalized;
        moveDirection.y = 0; // Keep the movement on the XZ plane
        rb.linearVelocity = moveDirection * movementSpeed;
    }
    // ...
}

So in the above code, if I were to word it out, I would say that the code is "creating a definition" for HandleMovement inside of PlayerLocomotion.

#

So when you say public void Func() {...}, you're telling the computer "this is a function called Func, and whenever you 'call' it, here's what I want you to do"

#

Are you following?

tropic kelp
#

i follow

dull nimbus
tropic kelp
#

alright thank you for your help

#

i appreciate it