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 capzulu · May 30, 2011 at 10:16 AM · disable object

Disable/Enable object imported from 3ds max

Hello to all,

First of all thanks for this awsome game engine :D

I'm having a problem in disable the rendering and the animation of one imported model from 3ds max. I've tried gameObect.enabled = false, gameObject.active = false, even added one Mesh Renderer to the object and tried gameObject.renderer.enabled = false. None of these worked, the object is always displayed. Is there any other option i could try?

I'm doing that on the pause menu:

function OnGUI(){

 GameObject.Find("MenuCam").GetComponent("Camera").enabled = true;
 GameObject.Find("MenuCam").GetComponent("Camera").transform.LookAt(Vector3.zero); 
 GameObject.Find("MenuCam").GetComponent("Camera").transform.Translate(0.05,0,0);
 
 rect = new Rect(0, 0, 150, 75);
 rect.x = (Screen.width  - rect.width ) / 2;
 rect.y = ((Screen.height - rect.height) / 2)-50;
 if(GUI.Button(rect, "Jogar")){
     GameObject.Find("MenuCam").GetComponent("Camera").enabled = false;
     GameObject.Find("bus").enabled = false;
     this.enabled = false;
 }

The object bus is one model imported from 3ds.

The problem is where i want to make the bus not visible.

Thanks

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 Meltdown · May 30, 2011 at 10:58 AM 0
Share

Can you edit your post and show us a sample of the exact code you are using to disable the object, as well as how you are trying to get an instance of the object.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by GlennHeckman · May 30, 2011 at 03:38 PM

Set your gameObject's active property to false, not enabled. The enabled property is for components (scripts on a game object) while active is for the gameObject itself. So your code will look like this:

  GameObject.Find("bus").active = false;
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
avatar image
0

Answer by capzulu · May 30, 2011 at 04:20 PM

I have found what my problem was, i needed to set the children active status to false.

I've used this function gameObject.SetActiveRecursively(false);

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

2 People are following this question.

avatar image avatar image

Related Questions

Disabling prefabs in a row one by one sequentially when an animation is played? 0 Answers

How to STOP music when loading a SPECIFIC SCENE? 3 Answers

Disable one of child of parent gameobject 1 Answer

What is the best way to update array in runtime? 3 Answers

Disabling a player in multiplayer then teleporting it to a different place 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