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 Bat2k · Jan 10, 2011 at 12:02 AM · errorsyntax-errorboobce0005

Can't compile script from Scripting Tutorial (translated to Boo)

Hi, I can't compile the following code inside Unity editor (unity 3.1 free, windows 7 HP). It says:

Assets/Movement.boo(11,60):BCE0005: Unknown identifier: '_speed'. Assets/Movement.boo(12,58):BCE0005: Unknown identifier: '_speed'.

I can't understand what's wrong with it...

import UnityEngine

class Movement (MonoBehaviour):

 public _speed = 5.0

 def Start ():
     pass

 def Update ():
     x = Input.GetAxis("Horizontal") * Time.deltaTime * _speed
     z = Input.GetAxis("Vertical") * Time.deltaTime * _speed
     Transform.Translate(x, 0, z)

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 Peter G · Jan 10, 2011 at 01:26 AM 0
Share

Have your tried declaring the type? I don't know much about Boo, but do you need a type i.e. _speed as single = 5.0F

avatar image Bat2k · Jan 10, 2011 at 09:57 AM 0
Share

It doesn't help.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Mike 3 · Jan 10, 2011 at 12:51 AM

Your code as is is fine except the last line, which should be transform instead of Transform.

Not entirely sure why it's complaining about _speed - try relaunching unity perhaps?

Comment
Add comment · Show 4 · 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 Bat2k · Jan 10, 2011 at 08:04 AM 0
Share

Removing _speed references brings back an error that I need to have instance of Transform (e.g. transform) to get access to non static member Translate. Weird...

$$anonymous$$ay be this is the clue?

avatar image Mike 3 · Jan 10, 2011 at 08:27 AM 0
Share

Yup, the code compiles fine for me changing Transform to transform

avatar image Bat2k · Jan 10, 2011 at 09:43 AM 0
Share

Strange, but I've changed transform to Transform because of error

Assets/$$anonymous$$ovement.boo(13,9):BCE0005: $$anonymous$$ identifier: 'transform'.

No I got an error that an instance of Transform required to have an access to Translate method. This is expectable.

But the error with transform/Transform may be the clue...? It seems that I'm missing something not related to the code itself...

By the way since my code is ok, did you manage to compile it in your enironment?

avatar image Bat2k · Jan 10, 2011 at 09:46 AM 0
Share

Thank you, I'll try to experiment a little bit more. I can remember that there was no Transform issue before I added members of the class. I'll keep you posted in case I find what's wrong.

avatar image
0

Answer by Bat2k · Jan 10, 2011 at 10:17 AM

Ok, I recreated the project from scratch and it just works. No more variable/Transform issues.

Comment
Add comment · Show 2 · 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 Ippokratis · Mar 30, 2011 at 11:01 AM 0
Share

Perhaps you could edit your question by including what you did to solve it so people do not have to read all the posts ?

avatar image ironmagma · Dec 05, 2011 at 03:16 AM 0
Share

I'm almost certain this problem was caused by a bug in Boo where it will not alert you of mismatched whitespace. Odds are, he was using spaces to indent one part (probably copy/pasted) and tabs to indent the last function [or vice versa]. Boo interprets this as Update being a standalone function — not a method of $$anonymous$$ovement. As a result, it's no longer in the class's scope and _speed is undefined.

avatar image
0

Answer by aidenkael · Nov 12, 2013 at 01:24 AM

I always have this problem. In Boo, I never set a public or private before a variable as this has ALWAYS caused compile errors. In my opinion Boo is a broken language, and I would switch to c# or JS unless you have to use Boo for some reason. In addition to better support and resources, they can also aid you if you ever decide to be a computer science major or get a programming job.

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

2 People are following this question.

avatar image avatar image

Related Questions

jumping error!? 4 Answers

I have an error while building the game 1 Answer

I got a major question 1 Answer

CharacterDamage script semi colon error. 1 Answer

Need some help with my Gravity Gun, New to Scripting. 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