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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
1
Question by ina · Dec 27, 2010 at 04:34 AM · gameobjectidethis

Difference between gameObject and GameObject and a scene item named "GameObject" and this in context of Unity grammar

This is related to another thread, except this was not compared there, nor Unity's usage of capitalization and inclusion of spaces-in-variable-names-in-editor,* so for clarity, please explain here!

(Community wiki)

Some further questions:

  • Why are variables called cameraOffset labeled as "Camera Offset" in inspector? Why the inclusion of a space?

  • Why is it that when you have a Mesh.js in asset, it'd stop the whole show? Is there a list of "forbidden file names"?

Comment
Add comment · Show 1
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 Justin Warner · Dec 27, 2010 at 04:45 AM 0
Share

Just like GUI.js So I'd say their are some names you can't use.

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Wiki

Answer by Mike 3 · Dec 27, 2010 at 04:42 AM

  • Why are variables called cameraOffset labeled as "Camera Offset" in inspector? Why the inclusion of a space?

This is because the GUI has a function to make variable names readable - it'll turn camelCaseName into Readable Language Name. It splits every time it finds a capital letter in the camel case version, adding a space there.

  • Why is it that when you have a Mesh.js in asset, it'd stop the whole show? Is there a list of "forbidden file names"?

Any time you overload the name of a unity class, it'll go wonky. Check the list of classes used in the runtime api here: http://unity3d.com/support/documentation/ScriptReference/20_class_hierarchy.html

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 ina · Dec 27, 2010 at 05:55 AM 0
Share

when you reference a script -- say "BobJones.js" in another object, do you call it as GetComponent(BobJones) or GetComponent("Bob Jones") - and what about the variables?

avatar image
1
Wiki

Answer by Jesse Anders · Dec 27, 2010 at 04:48 AM

The difference between 'GameObject' and 'gameObject' is as described in the other thread (although I'm not sure about the GetComponent() part - I've never seen that before, and I haven't tried it myself).

For a game object to be named 'GameObject' is completely incidental and has nothing to do with the class named 'GameObject'. It would be like if you had a cat and named it 'cat'. Yes, the cat's name also happens to describe what it is, but that's incidental; the cat could just as well be named 'Mittens' or 'Fluffy'.

Regarding cameraOffset vs. Camera Offset, that's just a (sort of confusing) bit of 'humanization' that Unity does for you. The variable is, indeed, named cameraOffset, but Unity 'humanizes' variable names for display in the inspector. This means that the names of the variables as seen in the inspector are often different than the variables' actual names in the source code. (Among other things, a space is not a valid character for symbols such as variable and function names, etc.)

Not sure about Mesh.js, but I'd guess it has something to do with the fact that there's already a class called Mesh (maybe). [Edit: See Mike's answer above.]

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 Mike 3 · Dec 27, 2010 at 04:55 AM 0
Share

Added a reply on the other question about the GameObject thing, it's not valid

avatar image dissidently · Dec 27, 2010 at 08:25 AM 0
Share

Any chance one of the genius/guru's of UnityScript could layout all the relationships and ways to call objects and components attached to objects in a manner that makes easy sense to a pleb? The pleb being me. And from the looks of things, a few others...

avatar image Jesse Anders · Dec 27, 2010 at 06:32 PM 0
Share

@dissidently: It may not answer every question you have, but I'd recommend starting here: http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html.

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

No one has followed this question yet.

Related Questions

A node in a childnode? 1 Answer

Hi, getting error cs1041 in my code:identifier expected, "this" is a keyword; need solution please 3 Answers

How to set image in Aspect fit on Texture2D 0 Answers

Collecting game objects in specific order 1 Answer

C# Check If Gameobject is within Collider 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