Error Unity 5 apparently code

1

I was doing this game when this problem appeared

  

Assets / SampleAssets / 2D / Scripts / Platformer2DUserControl.cs (2.25): error CS0234: The type or namespace name CrossPlatformInput' does not exist in the namespace UnitySampleAssets'. Are you missing an assembly reference?

My code is as follows

using UnityEngine;
using UnitySampleAssets.CrossPlatformInput;

namespace UnitySampleAssets._2D
{

    [RequireComponent(typeof (PlatformerCharacter2D))]
    public class Platformer2DUserControl : MonoBehaviour
    {
        private PlatformerCharacter2D character;
        private bool jump;

        private void Awake()
        {
            character = GetComponent<PlatformerCharacter2D>();
        }

        private void Update()
        {
            if(!jump)
            // Read the jump input in Update so button presses aren't missed.
            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.
            character.Move(h, crouch, jump);
            jump = false;
        }
    }
}
    
asked by anonymous 03.09.2015 / 21:24

2 answers

1

The "UnitySampleAssets" package was made available in the Unite event in 2014, in a lecture on best practices for 2D games on Unity, you can download it here here .

In this file you will find this script that is missing.

Link to the talk (I recommend): link

    
14.09.2015 / 22:49
0

I do not know about this UnitySampleAssets package. Did you even care? Have not you accidentally deleted some folder from him?

To resolve this problem, you can either reimport this package or stop using CrossPlatformInput. Commenting the line using UnitySampleAssets.CrossPlatformInput; and changing all CrossPlatformInputManager to Input .

    
14.09.2015 / 21:36