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 Beanalby · Mar 25, 2012 at 08:55 PM · javascriptcomponenthalo

Cannot reference "Halo" type in Javascript

I have a Halo component attached to a child GameObject, but trying to use the Javascript

 var h = GetComponentInChildren(Halo);

Gives

 Assets/Selection.js(8,42): BCE0005: Unknown identifier: 'Halo'.

On the child GameObject itself, I can do this:

 var test : Component = GetComponent("Halo");
 Debug.Log("direct type: " + test.GetType());

which prints

 direct type: UnityEngine.Behaviour

I expected to get the specific Halo type back (like UnityEngine.BoxCollider) rather than the generic Behavior.

Is there something "special" about Halo, where it doesn't have its own type? If so, what's the proper method for referencing it in a similar manner to GetComponentInChildren?

Using Unity 3.5.0f5, MonoDevelop 2.8.2

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

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Eric5h5 · Mar 25, 2012 at 09:02 PM

Not everything is exposed to scripting; Halo is one of those things that isn't.

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 Beanalby · Mar 26, 2012 at 01:15 PM 0
Share

Simple enough; is there any way to tell what is and isn't available, besides "just try it"? Looking in the docs for "Halo" and "Lens Flare" (another light effect), I couldn't see anything that would indicate one would be available, and another wouldn't.

avatar image Bunny83 · Mar 26, 2012 at 01:39 PM 1
Share

Well, usually just look into the scripting reference. At the left side you get a complete alphabetically sorted list of all classes / structs available. Well there are some undocumented classes that can also be used, but you shouldn't rely on them since they could be removed at any time.

There's also a hierarchical list

avatar image Eric5h5 · Mar 26, 2012 at 02:41 PM 0
Share

Using the documentation search, "lensflare" comes up with results and "halo" doesn't, so that's a pretty clear indication.

avatar image
1

Answer by Rodmanix · Nov 19, 2013 at 08:15 PM

Maybe this is new functionality since this question but it is now accessible.

var halo : Behaviour;

halo = GetComponent("halo");

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to change camera on trigger enter unity 5 1 Answer

how to disable a script component 1 Answer

[CLOSED] Halo position 0 Answers

Adjusting size of a halo in C# 0 Answers

Set a Prefab's variable when you instantiate it, but before it calls Awake? 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