Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Apexuni · Apr 07, 2010 at 05:06 AM · getcomponentinchildren

GetComponentInChildren question

i have one cube & 6 children attach to Cube Game object & one of these children have "Swing" script attach i want to disable that but there is error coming

i using this script attach to the cube game object

   if (Input.GetButtonDown("Inflated") && (currentform != 2))
   {
        GetComponent("NFmovement").enabled = false;
                GetComponentInChildren("RopeLogic").enabled=false;
        normalform.gameObject.SetActiveRecursively(false);
        inflatedform.gameObject.SetActiveRecursively(true);
        GetComponent("IFmovement").enabled = true;
        currentform = 2;
   }
}

& the error is : No appropriate version of 'UnityEngine.Component.GetComponentInChildren' for the argument list '(String)' was found.

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

1 Reply

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

Answer by Jessy · Apr 07, 2010 at 05:24 AM

As you can see in the documentation, you can't use strings as arguments with GetComponentInChildren, the way you can with GetComponent. So just leave off the quotation marks. Even with GetComponent, you should leave them off for better performance.

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 Apexuni · Apr 07, 2010 at 05:36 AM 0
Share

i already try this but still above error co$$anonymous$$g & another error co$$anonymous$$g that $$anonymous$$ identifier: 'RopeLogic'.

avatar image Jessy · Apr 07, 2010 at 06:45 AM 0
Share

Are you mixing JavaScript and C#? I don't recommend it, but I don't see why you'd get that error otherwise. Here's information on how to deal with that:

http://answers.unity3d.com/questions/7054/can-java-scripts-and-c-scripts-be-mixed-in-a-single-project

avatar image Apexuni · Apr 07, 2010 at 08:44 AM 0
Share

i figure out how to do that by the way thanks for helping me

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

How to correctly use GetComponentInChildren 2 Answers

Text Not Being Displayed above Instantiated Prefabs 0 Answers

instantiate an prefab and get its child's script 1 Answer

how do I change the properties of a material that are on the children of an object on script? 1 Answer

GetComponent in parent question 3 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