Hello, I’m trying to load a script called PlayerInputHandler.cs inside another script called Shoot.cs
This is part of the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shoot : MonoBehaviour
{
......
......
PlayerInputHandler m_InputHandler;
// Start is called before the first frame update
void Start()
{
m_InputHandler = GetComponent<PlayerInputHandler>();
}
The error I get is:
Shoot.cs 34,5 The type or namespace name PlayerInputHandler could not be found (are you missing a using directive or an assembly reference'
And this is the line of code it sends me to(line 34):
PlayerInputHandler m_InputHandler;
Note: I used a Unity’s template for a first-person shooter game, and it loads the PlayerInputHandler in other scripts in it works fine like this one:
using Unity.FPS.Game;
using UnityEngine;
using UnityEngine.Events;
namespace Unity.FPS.Gameplay
{
[RequireComponent(typeof(CharacterController), typeof(PlayerInputHandler), typeof(AudioSource))]
public class PlayerCharacterController : MonoBehaviour
{
[Header("References")] [Tooltip("Reference to the main
...... // There Are more things here//
PlayerInputHandler m_InputHandler;
void Start()
{
m_InputHandler = GetComponent<PlayerInputHandler>();
DebugUtility.HandleErrorIfNullGetComponent<PlayerInputHandler, PlayerCharacterController>(m_InputHandler,
this, gameObject);
}
Scripts path:
Assets/Avatars/IronMan/Scripts/Shoot.cs
Assets/FPS/Scripts/Gameplay/Managers/PlayerInputHandler.cs
Assets/FPS/Scripts/Gameplay/Managers/PlayerInputHandler.cs