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

TouchPad in C#

Hello, How can i use this code in C#? var rotateTouchPad : Joystick;

Comment
Add comment
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
0

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

 public Joystick rotateTouchPad;
Comment
Add comment · 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
0

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
Add comment · 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
0

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

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

Comment
Add comment · 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.

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

Trouble converting player controller from JS to C# 1 Answer

Convert this line of javascript to C# (easy) 1 Answer

Script Convert 1 Answer

Trouble with converting some JS code to C# 1 Answer

translated script from C# to JS; GUI not working properly? 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