mainMenuRef is static, so you canât access it through an instance. I donât know if you really intend for it to be static, but either remove the static or access it like this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public CharacterController controller;
public float gravity = 9.81f;
public float speed = 12f;
public Transform groundCheck;
public float grouondDistance = 0.4f;
public LayerMask groundMask;
public Physics Physiscs;
Vector3 velocity;
bool isGrounded;
// Update is called once per frame
void Update()
{
isGrounded = Physiscs.CheckSphere(groundCheck.position, grouondDistance, groundMask);
if(isGrounded && velocity.y < 0)
{
velocity.y = -2f;
}
float x = Input.GetAxis(âHorizontalâ);
float z = Input.GetAxis(âVerticalâ);
Vector3 move = transform.right * x + transform.forward * z;
controller.Move(move * speed * Time.deltaTime);
velocity.y -= gravity * Time.deltaTime;
controller.Move(velocity * Time.deltaTime);
}
}
mine says: Assets\Scripts\PlayerMovement.cs(23,22): error CS0176: Member âPhysics.CheckSphere(Vector3, float, int)â cannot be accessed with an instance reference; qualify it with a type name instead
Thatâs fine but please create your own threads and not hijack an existing (old) thread just because it has the same compilation error. These kinds of errors are from you typing stuff that isnât correct, itâs not the SAME problem.
Assets/Script/Dist.cs(25,35): error CS0176: Member âOutline.Mode.OutlineHiddenâ cannot be accessed with an instance reference; qualify it with a type name instead
Please do not hijack threads and try to read the Community Code of Conduct before proceeding. If you are going to hijack a thread then please read what the thread is about. This thread is marked as resolved and even describes what the problem is which is your understanding of Static members.
Please create your own threads and always post code using code-tags and not plain text.