• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jdeter14 · Jul 07, 2014 at 09:11 AM · errorcs0103

Error CS0103?

Hi,

I'm getting a CS0103 error, Assets/Sample Assets/2D/Scripts/Platformer2DUserControl.cs(19,21): error CS0103: The name CrossPlatformInput' does not exist in the current context and Assets/Sample Assets/2D/Scripts/Platformer2DUserControl.cs(31,27): error CS0103: The name CrossPlatformInput' does not exist in the current context

Here is my code: alt text

screen shot 2014-07-06 at 11.37.55 pm.png (248.8 kB)
Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gjf · Jul 07, 2014 at 09:14 AM 0
Share

the error is that you haven't provided a reference to CrossPlatformInput. where is it defined?

avatar image jdeter14 · Jul 28, 2014 at 01:01 AM 0
Share

How do I use code tags? Is there a way to search the entire code to see where else CrossPlatformInput is defined?

using UnityEngine;

[RequireComponent(typeof(PlatformerCharacter2D))] public class Platformer2DUserControl : $$anonymous$$onoBehaviour { 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 CROSS_PLATFOR$$anonymous$$_INPUT
     if (CrossPlatformInput.GetButtonDown("Jump")) jump = true;
     #else
     if (Input.GetButtonDown("Jump")) jump = true;
     #endif
     
 }
 
 void FixedUpdate()
 {
     // Read the inputs.
     bool crouch = Input.Get$$anonymous$$ey($$anonymous$$eyCode.LeftControl);
     #if CROSS_PLATFOR$$anonymous$$_INPUT
     float h = CrossPlatformInput.GetAxis("Horizontal");
     #else
     float h = Input.GetAxis("Horizontal");
     #endif
     
     // Pass all parameters to the character control script.
     character.$$anonymous$$ove( h, crouch , jump );
     
     // Reset the jump input once it has been used.
     jump = false;
 }

}

avatar image Hexer · Jul 28, 2014 at 01:13 AM 0
Share

Question, where does CrossPlatformInput refer to? I can't find it in the UnityReference.

You also define "float h" two times which I don't understand.

avatar image gjf · Jul 28, 2014 at 12:15 PM 0
Share

h is defined in a conditional, so only really once. it ain't pretty, but it'll work ;)

avatar image jdeter14 · Jul 29, 2014 at 01:33 AM 0
Share

appreciate the help. i added the CrossPlatformInput from the sample assets and got the project functioning again!

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by JohnnySunshine · Jul 28, 2014 at 01:33 PM

If you have this error, and CROSS_PLATFORM_INPUT is defined, then you probably imported the Sample Assets and somehow deleted CrossPlatformInput.cs. You should reimport it from the package (along with the whole Cross Platform Input folder), and it will work again.

Alternatively, if you were deliberately trying to get rid of it, go to Edit > Project Settings > Player Settings, look for the Other Settings tab, and remove CROSS_PLATFORM_INPUT from Scripting Define Symbols.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jdeter14 · Jul 29, 2014 at 12:21 AM 0
Share

thanks for the help guys. i added the CrossPlatformInput from the sample assets and got the project functioning again!

avatar image
0

Answer by SlyGameStudios · Apr 15, 2016 at 05:26 AM

please help http://answers.unity3d.com/questions/1170781/error-cs0103-cross-platform-input.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Error from the Time Of day asset?? 0 Answers

error CS0103: The name `AttributeName' does not exist in the current context 0 Answers

i get this error and i don't know what to do 1 Answer

CS0103 Error 1 Answer

Error Code CS0103 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges