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 M2aProductions · Nov 25, 2014 at 11:40 AM · bugs

How to Code?

Hello there! So I have been messing around with Unity3D for the last year, and I've gotten pretty good at it. However, there is one key thing in making unity stuff that I don't know. It's how to code in Js/C#/Boo. I try a lot of tutorials online, they give me some code and I paste it into MonoDevelop. But each time I try to run the game, it says there's an error with the script. There was once a guy that rather than giving a block of text to copy/paste, he gave the script as a free download. It came out just fine, so I don't know what I'm doing wrong. Any help would be appreciated!

The error looks like this : alt text

By the way, here's the code I'd like to use :

 var target : Transform; 
 var moveSpeed = 3; 
 var rotationSpeed = 3; 
 var myTransform : Transform; 
 
 function Awake(){ myTransform = transform; 
 }
 
 function Start(){ target = GameObject.FindWithTag("Player"­;).transform; 
 }
 
 function Update () { var lookDir = target.position - myTransform.position; lookDir.y = 0; // zero the height difference myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(lookDir), rotationSpeed*Time.deltaTime); myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
 }


skærmbillede 2014-11-25 kl. 10.43.22.png (10.0 kB)
Comment
Add comment · Show 2
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 HarshadK · Nov 25, 2014 at 09:48 AM 2
Share

You have a semicolon ';' after your "Player" which should not be there.

The sentence should be:

function Start(){ target = GameObject.FindWithTag("Player"­).transform;

Note:

  1. Format your code properly.

  2. You should start learning program$$anonymous$$g from basic and remember to try to write code by yourself to test out things that you have learned, not by just copy pasting someone else's code.

avatar image Baste · Nov 25, 2014 at 12:55 PM 0
Share

Formatted your code.

And for the question 'how to code'? Not by copy-pasting scripts! If you want to learn, there's half a million tutorials out there. Like the official Unity tutorials.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by MuffinMyst · Nov 25, 2014 at 01:05 PM

I've found the unity manual/scripting data base helpful in learning to code. I've had some bare minimal training though (one or two intro to java and such) that gave me a starting point. I've watched the "Hack and Slash tutorial" from burgzergarcade that really takes you through alot of different things. Starting with making a basic character and mob, to building off of those to make more complex things. Testing each line as you go to make sure it's doing what you want it to. Since then I've been using what I know and asking stuff here when I couldn't find it through searches. But its really good to understand what the code you're using does. And at least a basic understanding of how the commands are suppose to work. I've tried with java and with C# (I find i prefer C#) and haven't done anything with Boo... though that might change.

Try searches... brush up on basics... watch/read tutorials, and if you still can't find the answer then you still have here ;)

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
avatar image
0

Answer by Pendrokar · Nov 25, 2014 at 01:10 PM

Going to answer by explaining the error line.

Assets/EnemyAI.js - file that has the error

(9,59) - location of error (line number in file, column of that line)

BCE0044: - Error code (You may search the internet for it to find out more)

unexpected char: - name/short description for error code

0xAD - character code of the character(semicolon ";") that is causing this error

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Bizarre "script changes not changing anything" issue ??? 1 Answer

wanting instance a variable of other script file?? 1 Answer

Mono Develop NOT OPENING 0 Answers

Unity VSync & Targetframerate Stutter 1 Answer

Need help: Replay have bug... 0 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