• 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
Question by MehmetOguzDerin · Aug 19, 2013 at 07:24 AM · c#javascriptconvertsimplefrom

TouchPad in C#

Hello, How can i use t$$anonymous$$s code in C#? var rotateTouchPad : Joystick;

Comment

People who like this

0 Show 0
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

3 Replies

· Add your reply
  • Sort: 
avatar image

Answer by Sajidfarooq · Aug 19, 2013 at 07:25 AM

 public Joystick rotateTouchPad;
Comment

People who like this

0 Show 6 · 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 MehmetOguzDerin · Aug 19, 2013 at 07:27 AM 0
Share

Not working. Type or namespace name problem.

avatar image MehmetOguzDerin · Aug 19, 2013 at 07:49 AM 0
Share

Really, there isn't any Joystick namespace in C#?

avatar image DaveA · Aug 19, 2013 at 07:52 AM 0
Share

Unless you have a script called Joystick. It's not about C#, it's about your project in general (you'd get the same error with JS) Read http://docs.unity3d.com/Documentation/ScriptReference/Input.GetAxis.html

avatar image Sajidfarooq · Aug 19, 2013 at 07:52 AM 0
Share

I simply converted your code from JavaScript to C#, as per the question.

Are you saying the original works in JavaScript, but not in C#?

avatar image MehmetOguzDerin · Aug 19, 2013 at 07:56 AM 0
Share

I imported all the needed assets. Yes, works with JavaScript but not with C#.

Show more comments
avatar image

Answer by DaveA · Aug 19, 2013 at 07:53 AM

Sajidfarooq has the correct C# syntax. You need to import the Standard Assets (Mobile) package.

Comment

People who like this

0 Show 3 · 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 Sajidfarooq · Aug 19, 2013 at 07:56 AM 0
Share

If the problem was with import, he would see the same problem with JavaScript. Strange that the OP blames C# !

avatar image DaveA · Aug 19, 2013 at 08:03 AM 0
Share

Yeah. OTOH sometimes these errors don't pop up until running. I think if you don't use types all the time, it might do that. Like

var joystick;

would not resolve to Joystick until set at runtime. But using the type

var joystick : Joystick;

should warn right away

avatar image Sajidfarooq · Aug 19, 2013 at 08:17 AM 0
Share

Remember the OP was using strict-typing (var rotateTouchPad : Joystick). I'm guessing it did "warn", but newbies tend to ignore everything except for a downright error, something that wont let them proceed until fixed.

avatar image

Answer by MehmetOguzDerin · Aug 19, 2013 at 09:28 AM

Hello, http://wiki.unity3d.com/index.php?title=Joystick T$$anonymous$$s code isn't works. At least no touchpads on screen.

Comment

People who like this

0 Show 11 · 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 Sajidfarooq · Aug 19, 2013 at 09:32 AM 0
Share

You should follow the Penelope tutorial in order to understand the joystick code.

Please do not post comments as answers. Read the FAQ in order to understand how you are supposed to ask questions here, how to answer, and what the voting process is. Your "karma" is still 1, which means every time you post, someone has to "approve" your post.

avatar image MehmetOguzDerin · Aug 19, 2013 at 09:40 AM 0
Share

It works on JS but not on CS you don't get it? I know how to use. Just CS problem.

avatar image Sajidfarooq · Aug 19, 2013 at 09:56 AM 0
Share

Lose the attitude.

You havent answered my previous comment on exactly what you mean by "works".

Have you tried publishing your code, and the JS version actually accepts the touch-pad input? Or are you running it in the simulator?

avatar image MehmetOguzDerin · Aug 19, 2013 at 09:58 AM 0
Share

Hello, I'm working with Unity Remote 3 on iPhone. JS version was visible, but you know the var problem. CS solved the VAR problem but TouchPad's are invisible.

avatar image Sajidfarooq · Aug 19, 2013 at 09:59 AM 0
Share

What var problem? Also, the Unity Remote converts touch to mouse-click, so you need to actually deploy to the device to properly test.

Show more comments

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 People are following this question.

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

Related Questions

How to make this line work in C#? 1 Answer

Help converting this to C# - a few issues 3 Answers

Does C# use #pragma strict? 2 Answers

What is this C# code in javascript 0 Answers

java to C# conversion 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