Hello,
I am trying to use MovingSide method which is in PlayerPlayableCharacter class in Update.
I am 3 days in and lost hours to this. Yes I am new to cSharp and nowhere to ask. I am not getting it right.
heres the code:
public class PlayerController : MonoBehaviour
{
public Vector3 position;
public float speed = 1f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
PlayerPlayableCharacter.MovingSide();
}
public class PlayerPlayableCharacter : PlayerController
{
public void MovingSide()
{
var transform1 = transform;
var movingSide = Input.GetAxis("Horizontal");
var movingXSpeed = movingSide * speed * Time.deltaTime;
transform1.position += transform1.position + new Vector3(movingXSpeed, 0f, 0f);
}
}
I am unable to compile it and I am getting Cannot access non-static method ‘MovingSide’ in static context.
If I add static to public void MovingSide() then I am getting red lines on transform.
Could someone pls help?
thank you