been stuck on this for literal days im pretty sure its not a spelling error
Assets\Scripts\Character\Player\PlayerInputManager.cs(41,39): error CS0103: The name ‘WorldSaveGameManager’ does not exist in the current context
Here are my two scripts
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Collections
{
public class PlayerInputManager : MonoBehaviour
{
public static PlayerInputManager instance;
PlayerControls playerControls;
[SerializeField] Vector2 movementInput;
private void Awake()
{
if(instance == null)
{
instance = this;
}
else
{
Destroy(gameObject);
}
}
public void Start()
{
DontDestroyOnLoad(gameObject);
// WHEN THE SCENE CHANGES, RUN THIS LOGIC
SceneManager.activeSceneChanged += OnSceneChange;
instance.enabled = false;
}
private void OnSceneChange(Scene oldScene, Scene newScene)
{
// IF WE ARE LOADING INTO OUR WORLD SCENE, ENABLE OUR PLAYERS CONTROLS
if(newScene.buildIndex == WorldSaveGameManager.instance.GetWorldSceneIndex())
{
instance.enabled = true;
}
// OTHERWISE WE MUST BE AT THE MAIN MENU, DISABLE OUR PLAYERS CONTROLS
// THIS IS SO OUR PLAYER CANT MOVE AROUND IF WE ENTER THINGS LIKE A CHARACTER CREATION MENU ECT.
else
{
instance.enabled = false;
}
}
private void OnEnable()
{
if(playerControls == null)
{
playerControls = new PlayerControls();
playerControls.PlayerMovement.Movement.performed += i => movementInput = i.ReadValue<Vector2>();
}
playerControls.Enable();
}
private void OnDestroy()
{
// IF WE DESTROY THIS OBJECT, UNSUBSCRIBE FROM THIS EVENT
SceneManager.activeSceneChanged -= OnSceneChange;
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace CI
{
public class WorldSaveGameManager : MonoBehaviour
{
public static WorldSaveGameManager instance;
[SerializeField] int worldSceneIndex = 1;
private void Awake()
{
// THERE CAN ONLY BE ONE INSTANCE OF THIS SCRIPT AT ONE TIME, IF ANOTHER EXISTS, DESTROY IT
if (instance == null)
{
instance = this;
}
else
{
Destroy(gameObject);
}
}
private void Start()
{
DontDestroyOnLoad(gameObject);
}
public IEnumerator LoadNewGame()
{
AsyncOperation loadOperation = SceneManager.LoadSceneAsync(worldSceneIndex);
yield return null;
}
public int GetWorldSceneIndex()
{
return worldSceneIndex;
}
}
}