Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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.

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

weird false cs0103 error in monodevelop 3 Answers

Error Code CS0103 1 Answer

Error from the Time Of day asset?? 0 Answers

Odd compiler and "Error CS0103" 1 Answer

Error CS0103: The name `ctn' does not exist in the current context ?? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges