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
0
Question by HolBol · Jun 25, 2011 at 03:21 PM · gameobjectrigidbodyactive

'active' is not a member of 'System.Type'.

I'm trying to make an airbrake script. It should increase the drag on the rigidbody it's attached to, and enable/disable a GO. Here's the script.

 var airbrake = GameObject;
 
 function Start () {
 airbrake.active = false;
 rigidbody.drag = 0;
 }
 
 function Update () {
 if(Input.GetKeyDown(KeyCode.LeftShift)){
 airbrake.active = true;
 rigidbody.drag = 10;
 } else {
 airbrake.active = false;
 rigidbody.drag = 0;
 }
 }

Yet I get an error: 'active' is not a member of 'System.Type'. But I've disabled/enabled gameobjects this way before, so why is it not working now?! I have a script doing a similar thing, that on key press, it deactivates stuff and enables stuff, but this doesn't want to do it. HELP.

Comment
Add comment · Show 3
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 Bunny83 · Jun 25, 2011 at 04:26 PM 0
Share

Please indent your code.. it looks like the source code of google.com :D

avatar image HolBol · Jun 25, 2011 at 05:00 PM 0
Share

I dunno how to indent it, I use the default unity windows script editor- and it doesn't do auto indentation.

avatar image DallonF · Jun 25, 2011 at 08:02 PM 0
Share

Just press the Tab key before a line to indent it! You also might want to consider switching to $$anonymous$$onoDevelop, it's quite nice.

As a side note, I think google.com's source code is intentionally unindented :) They probably run a utility to remove whitespace from their code so that it loads faster.

2 Replies

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

Answer by DallonF · Jun 25, 2011 at 03:27 PM

The problem is in your first line:

 var airbrake = GameObject;

You're literally setting airbrake to equal the GameObject class. (I'm not sure of your experience with programming, but if you don't know what a class is, it would be a great idea to look it up)

This is the same issue that you would get if you did something like this:

 GameObject.active = false; //should be gameObject.active = false


Tl;dr: I think you'll want to replace your first line with this:

 var airbrake : GameObject;
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 HolBol · Jun 25, 2011 at 03:28 PM 0
Share

I feel stupid now for not noticing that. Grr, oh well, thanks!

avatar image RandomMcSomethin · Jan 24, 2015 at 05:07 PM 0
Share

Thanks! This helped with my game ^_^ I would upvote if I had 15 rep

avatar image
1

Answer by ckfinite · Jun 25, 2011 at 03:24 PM

Change

 var airbrake = GameObject;

to

 var airbrake : GameObject;
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 tilt the gameobject based of Input.Acceleration? 0 Answers

Unity3D Pressure Plate request. 3 Answers

Turning off rigidbody without turning the entire object inactive? 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

create a GuiSkin 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