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 Lacrymology · May 17, 2011 at 06:41 PM · typesyntaxboo

Boo help: method not defined

Hi, I'm a python lover, so I'm trying to get started in Boo, but the compiler fails saying among other things that "GetClickedGameObject is not a member of class ClickEnterGUI".

It's also complaining that GUIManager, Fader and OrtographicZoomer are unknown identifyers (they are behaviors defined in C#). Can someone give me a hand with this, please?

class ClickEnterGUI (MonoBehaviour):

 public clickLayerMask as LayerMask;

 def Start ():
     pass

 def Update ():
     if Input.GetMouseButtonDown(0):

         clickedObj = self.GetClickedGameObject()

         if clickedObj is not null:
             this.enabled = false
             gui = GameObject.Find("GUI")
             camera = GameObject.Find("MainCamera")
             fadeTime = gui.GetComponent(GUIManager).ActiveGUI.fadeTime
             camera.GetComponent(Fader).fadeOutIn(fadeTime, {
                     gn = clickedObj.GetComponent(GUIName);
                     computerGUI = gn.guiName;
                     gui.GetComponent(GUIManager).setGUI(computerGUI);
                     })
             camera.GetComponent(OrtographicZoomer).zoom(2)

 def GetClickedGameObject():
     // Builds a ray from camera point of view to the mouse position
     ray = Camera.main.ScreenPointToRay(Input.mousePosition)
     hit as RaycastHit

     // Casts the ray and get the first game object hit
     if (Physics.Raycast(ray, hit, Mathf.Infinity, clickLayerMask)):
         return hit.transform.gameObject
     else:
         return null

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

4 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by flaviusxvii · May 17, 2011 at 07:01 PM

In actual Python you'd have to declare your method as def GetClickedGameObject(self):

I LOVE Python more than any human alive. Boo is different enough I think it's a horrible language to use. Very inconsistent.

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 Lacrymology · May 17, 2011 at 08:06 PM 0
Share

I love python as well, and even if its true about Boo's problems, still being able to use some python idioms will be a relief while coding this stuff. OTOH, this does not answer my question at all...

avatar image flaviusxvii · May 17, 2011 at 08:08 PM 0
Share

Do you need to use self.GetClickedGameObject() if 'self' is not required while declaring the method? I'm not on a Unity-friendly machine at the moment so I can't try it.

avatar image ironmagma · Dec 05, 2011 at 12:52 AM 1
Share

Boo isn't inconsistent or a horrible language. Boo is just a different language from Python.

In Python, you can apply methods of one class to instances of another class, as a result of that syntax. In .NET CIL, that's not possible, which is why Boo ins$$anonymous$$d makes 'self' a keyword meaning 'this'. It preserves the style of Python while unfortunately not being able to provide the same functionality.

avatar image
0

Answer by almo · May 17, 2011 at 07:07 PM

Do you need to do some "import" statements to get access to the other C# stuff? Did you mean to spell OrtographicZoomer as OrthographicZoomer? (note the "h")

I'm not a Boo user, but these are the things I see that are suspicious.

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 Lacrymology · May 17, 2011 at 08:07 PM 0
Share

I thought of this as well. The compiler complains at the import as well, I might be missing the path, but I'm not sure about this.

avatar image almo · May 17, 2011 at 08:25 PM 0
Share

Hmm... tricky. If I think of anything else, I'll update my answer and leave another comment so your mail icon turns blue. :)

avatar image
0

Answer by Eric5h5 · May 17, 2011 at 09:03 PM

the compiler fails saying among other things that "GetClickedGameObject is not a member of class ClickEnterGUI".

You don't need "self."; just leave it out. "clickedObj = GetClickedGameObject()" Although it does work fine with it, so I guess you have some other issues.

It's also complaining that GUIManager, Fader and OrtographicZoomer are unknown identifyers (they are behaviors defined in C#).

See here.

Comment
Add comment · Show 1 · 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 ironmagma · Dec 05, 2011 at 12:49 AM 0
Share

While you don't need "self" in this instance, the keyword adds clarity to your code, and you should use it so other people (and you) know what you're doing when you call GetClickedGameObject().

avatar image
0

Answer by ironmagma · Dec 05, 2011 at 12:49 AM

Check your whitespace. Make sure that whatever form of spacing (spaces vs. tabs) that precedes your methods is the same for the whole document.

Boo has a bug where it will not notify you if it encounters weird whitespace, and this sounds like the kind of problem that arises from that bug. I have notified the creator of Boo about it, but there is yet to be a patch for it.

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

1 Person is following this question.

avatar image

Related Questions

what is the correct syntax for the creation of arrays? 2 Answers

syntax to define a variable of type "type"? 1 Answer

if (!(apple is Vege)) then... 1 Answer

Passing Type variable to generic type: Variable not found. 1 Answer

Boo conditional expressions 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