It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
I'm trying to follow the tutorial 'How to make a 2d platformer - Unity course' on Youtube but I'm stuck trying to use the 'Sample Assets' from Unity.
I am currently using Unity 2020.3.1f1
I understand the tutorial is very old, and reading the youtube comments, the 'Sample Assets' are no longer available but some people have had success with downloading 'Standard Assets (for Unity 2018.4).
I have done this but am also getting a couple more errors in the console window:
Assets\Standard Assets\2D\Scripts\Platformer2DUserControl.cs(23,26): error CS0103: The name 'CrossPlatformInputManager' does not exist in the current context
Assets\Standard Assets\2D\Scripts\Platformer2DUserControl.cs(32,23): error CS0103: The name 'CrossPlatformInputManager' does not exist in the current context
I have double clicked these errors to open Visual Studio. (I've been told by users that Visual Studio will fix the errors for you if you follow the prompts). This still didn't fix things for me, so wondering if I've messed up something in the broken script?
Here is the broken Platformer2dUserControl.cs
using UnityEngine;
namespace UnityStandardAssets._2D
{
[RequireComponent(typeof (PlatformerCharacter2D))]
public class Platformer2DUserControl : MonoBehaviour
{
private PlatformerCharacter2D m_Character;
private bool m_Jump;
public object CrossPlatformInputManager { get; private set; }
private void Awake()
{
m_Character = GetComponent<PlatformerCharacter2D>();
}
private void Update()
{
if (!m_Jump)
{
// Read the jump input in Update so button presses aren't missed.
m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
}
}
private void FixedUpdate()
{
// Read the inputs.
bool crouch = Input.GetKey(KeyCode.LeftControl);
float h = CrossPlatformInputManager.GetAxis("Horizontal");
// Pass all parameters to the character control script.
m_Character.Move(h, crouch, m_Jump);
m_Jump = false;
}
}
}