- Home /
The name `PlatformerCharacter2D' does not exist in the current context
using UnityEngine;
[RequireComponent(typeof(PlatformerCharacter2D))]
public class Platformer2DUserControl : MonoBehaviour
{
private PlatformerCharacter2D character;
private bool jump;
void Awake()
{
character = GetComponent<PlatformerCharacter2D>();
}
void Update ()
{
// Read the jump input in Update so button presses aren't missed.
if (Input.GetButtonDown("Jump")) jump = true;
}
void FixedUpdate()
{
// Read the inputs.
bool crouch = Input.GetKey(KeyCode.LeftControl);
float h = Input.GetAxis("Horizontal");
// Pass all parameters to the character control script.
character.Move( h, crouch , jump );
// Reset the jump input once it has been used.
jump = false;
}
}
Hi I got the sample assets on the store and imported the 2d folder and now it doesn't recognise PlatformerCharacter2D. : was following this tutorial https://www.youtube.com/watch?v=UbPiCgCkHTE i already got rid of this error [http://answers.unity3d.com/questions/755466/the-name-crossplatforminput-does-not-exist-in-the.html] but it still won't work.
Answer by mwnDK1402 · Jun 19, 2016 at 10:52 PM
Either the class is not in your Assets folder, or it's in another namespace.
Your answer
![](https://koobas.hobune.stream/wayback/20220612083226im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I get the character to jump in a 2d game, which is compatible with joysticks and keyboards? 0 Answers
2d Sidescroll problem with wall sliding 1 Answer
The name `CrossPlatformInput' does not exist in the current context 3 Answers
How solve the 2d collider penetration problem ? 2 Answers
Play and Stop Animation 1 Answer