#I m not really sure what you mean by

1 messages · Page 1 of 1 (latest)

bronze comet
#

Opening a new thread about it just not to clog the chat

#

The situation is the following: I have a Cursor (as you can see from the hierarchy) and a CursorController is attached to it as a component.

#

My Player looks like this:

scarlet grotto
#

What's the difference between Cursor and CursorController?

bronze comet
#
public class Player : MonoBehaviour
{
    public CursorController cursor;
    private PlayerInput _playerInput;

    private void Awake()
    {
        _playerInput = transform.GetComponent<PlayerInput>();
    }

    // Start is called before the first frame update
    void Start()
    {
        
    }

    public void FixedUpdate()
    {
        _playerInput.UpdateMovement();

        cursorC.ApplyMovement(_playerInput.Movement);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
#

Cursor is a GameObject, CursorController is a script that should take care of that gameobject's input's response

scarlet grotto
bronze comet
#

I had one, yes

scarlet grotto
#

make sure you don't have any compile errors in console

bronze comet
#

I used to have a Cursor script, that would call the CursorController

scarlet grotto
#

because your player script still seems to be looking for the Cursor script according to that screenshot - which could be due to compile errors

bronze comet
#

Indeed there are compiler errors atm

scarlet grotto
#

#1 should be to fix those.

#

you won't be able to do much of the rest without fixing them

bronze comet
#

Alright, should be all good now

#

Yes, it was still looking for that Cursor, as it couldn't fully recompile

#

Silly mistake- thank you!

#

Just to clarify

scarlet grotto
#

so has that resolved your issue? Do you see now how to assign the CursorController?

bronze comet
#

I can always attach an object (e.g.: Cursor) whenever I have an attribute that requires a component present in that object?

#

As I do seem to be able to do that:

scarlet grotto
#

If you have a public CursorController field, you can assign any object that has a CursorController from the same scene.

bronze comet
#

I dragged Cursor from the hierarchy to the attribute in the inspector

#

That's very practical

#

Nice, thanks!