- Home /
Assets\Standard Assets\Characters\Third Person Character\Scripts\Third Person User Control.cs(42,52): error C S 0103: The name 'Control Mode' does not exist in the current context
i am getting this error and one more please help me...
Assets\StandardAssets\Characters\ThirdPersonCharacter\Scripts\ThirdPersonUserControl.cs(42,52): error CS0103: The name 'ControlMode' does not exist in the current context
and one more error also appear related to this....
Assets\StandardAssets\Characters\ThirdPersonCharacter\Scripts\ThirdPersonUserControl.cs(42,17): error CS0103: The name 'GameControl' does not exist in the current context
script is this
using System;
using UnityEngine;
using CnControls;
[RequireComponent(typeof(ThirdPersonCharacter))]
public class ThirdPersonUserControl : MonoBehaviour
{
private ThirdPersonCharacter m_Character; // A reference to the ThirdPersonCharacter on the object
private Transform m_Cam; // A reference to the main camera in the scenes transform
private Vector3 m_CamForward; // The current forward direction of the camera
private Vector3 m_Move;
private bool m_Jump; // the world-relative desired move direction, calculated from the camForward and user input.
public void Start()
{
// get the transform of the main camera
if (Camera.main != null)
{
m_Cam = Camera.main.transform;
}
else
{
Debug.LogWarning(
"Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
// we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
}
// get the third person character ( this should never be null due to require component )
m_Character = GetComponent<ThirdPersonCharacter>();
}
public void Update()
{
if (!m_Jump)
{
if (GameControl.manager.controlMode == ControlMode.simple)
{
m_Jump = Input.GetButtonDown("Jump");
}
else if (GameControl.manager.controlMode == ControlMode.touch)
{
if (GameControl.jump)
{
m_Jump = true;
GameControl.jump = false;
}
}
}
}
// Fixed update is called in sync with physics
private float h, v;
public void FixedUpdate()
{
// read inputs
if (GameControl.manager.controlMode == ControlMode.simple)
{
h = Input.GetAxis("Horizontal");
v = Input.GetAxis("Vertical");
}
else if (GameControl.manager.controlMode == ControlMode.touch)
{
h = CnInputManager.GetAxis("HorizontalJoystick");
v = CnInputManager.GetAxis("VerticalJoystick");
}
bool crouch = Input.GetKey(KeyCode.C);
// calculate move direction to pass to character
if (m_Cam != null)
{
// calculate camera relative direction to move:
m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized;
m_Move = v * m_CamForward + h * m_Cam.right;
}
else
{
// we use world-relative directions in the case of no main camera
m_Move = v * Vector3.forward + h * Vector3.right;
}
#if !MOBILE_INPUT
// walk speed multiplier
if (Input.GetKey(KeyCode.LeftShift)) m_Move *= 0.5f;
#endif
// pass all parameters to the character control script
m_Character.Move(m_Move, crouch, m_Jump);
m_Jump = false;
}
}
The error sais that it cant find 2 classes, are they your classes or third party ones? If they are thirdpsrty can you locate them in your project? Or they are missing?
Your answer
![](https://koobas.hobune.stream/wayback/20220613002853im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2018's standard assests in 2019.3.9f1 0 Answers
How to fix WordPress script error? Please help! 0 Answers
Win32Exception 2 Answers
Prefab clones aren't deleting? 1 Answer
standard assets 1 Answer