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 craytowers · Jun 05, 2015 at 05:02 PM · coroutinecharacter controllerienumerator

3rd person controller in c#?

Hi, I have been using unity's 3rd person character controller and camera controller. I am however having some issues with IEnumerators and coroutines. I am learning C# and this script is written in javascript. I can use IEnumerators and coroutines fine in C# but I don't know how to use them properly in JS.

Is there anywhere I can get the exact same character controller/camera controller scripts in C#? I have looked everywhere and so far only found 1 that had been translated by someone and it didnt seem to work for me.

Thanks a lot

Comment
Add comment · Show 3
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 Gardes · Jun 06, 2015 at 02:19 AM 1
Share

C#

     IEnumerator WaitAndPrint(float waitTime) {
         yield return new WaitForSeconds(waitTime);
         print("WaitAndPrint " + Time.time);
     }

JS

     function WaitAndPrint (waitTime : float) {
         yield WaitForSeconds (waitTime);
         print ("WaitAndPrint "+ Time.time);
     }

There is not too much difference. Hope this helps. Taken from the official docs.

avatar image maccabbe · Jun 06, 2015 at 04:02 AM 0
Share

This is a poorly worded question.

If you are using unity's built in 3rd person character and camera controllers then they shouldn't depend on the program$$anonymous$$g language. Otherwise, if you are using a custom 3rd person character controller then you should share which one. I'm also not sure why you spend the first few sentences discussing IEnumerators and coroutines without discussing how it relates to the controllers.

avatar image craytowers · Jun 07, 2015 at 08:20 PM 0
Share

@Gardes Thank you, this helps me out a lot!

@maccabbe unity's 3rd person controller is written in JS - I didnt know how to use IEnumerators/coroutines in JS, only C#. Question made perfect sense. Why would you even take time to reply if you arent going to try and help out?..

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by maccabbe · Jun 07, 2015 at 10:06 PM

I tried to answer as best I could given the question submitted. Since you submitted this as "3rd person controller in c#?" it originally seemed like the part about IEnumerators and Coroutines had something to do with the 3rd person controller. Based on your response this does not seem to be the case.

If you need help programming in I recommend you follow the unity scripting tutorials which provide examples of both C# and javascript syntax

https://unity3d.com/learn/tutorials/modules/beginner/scripting

For instance the following has a video of how to use coroutines along with 3 different examples in both languages, just click on the tabs labeled C# and JS on top of the scripts to chose what language to display.

https://unity3d.com/learn/tutorials/modules/intermediate/scripting/coroutines

Next, Unity's CharacterController (and pretty much everything else built into unity) is not specific to JS. In the scripting API there is a JS and C# tab in the top right which lets you select what language you want to see the syntax for and see the examples.

http://docs.unity3d.com/ScriptReference/CharacterController.Move.html http://docs.unity3d.com/ScriptReference/CharacterController.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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

What can cause a coroutine to not being working? 9 Answers

How to make loop with call to IEnumerator actually pause? 2 Answers

How can you tell if a gameobject is looking directly at another gameobject? 1 Answer

WaitForSeconds Not Working 4 Answers

Problem with coroutine 2 Answers


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