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 /
avatar image
2
Question by Boruta · Mar 09, 2015 at 12:54 PM · buildsetactiverunfalsemode

Why does gameObject.SetActive (false) doesn't work???

Hi,

I have a serious problem with my script.

 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 using UnityEngine.EventSystems;
 
 public class Plane_swap : MonoBehaviour, IPointerClickHandler
 {
     public GameObject plane;
     public GameObject plane2;
     public void OnPointerClick(PointerEventData eventData)
     {
         plane.SetActive (false);
         plane2.SetActive (true);
     }
 }

When I launch it in editor mode, it works perfectly. HOWEVER, when I build & run my project(for Windows), it's not that great. Although function SetActive(true) works as intended, SetActive(false) doesn't(or so I think) for planes show up at scene, but they don't dissapear after deactivating them.

Here's bunch of screenshots, that depict my issue:

  • http://scr.hu/0cu1/wv3xh

  • http://scr.hu/0cu1/jijek

  • http://scr.hu/0cu1/ze19r

  • http://scr.hu/0cu1/tyjhm

When you take a closer look at the screenshots from build & run mode, you can see that behind the currently active plane, there are all previously activated planes.

By the way, may you explain my the reason for such a difference between colours in edit mode and in build & run mode???

Comment
Add comment · Show 8
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 fafase · Mar 09, 2015 at 12:57 PM 0
Share

Are you in Free Aspect? Also, the Scene view is not the Game view so the one you need to look at is the GameView. Scene view is for working only.

avatar image Owen-Reynolds · Mar 09, 2015 at 04:13 PM 0
Share

I've never heard of a problem with SetActive(false) not working.

There's probably a mistake somewhere else -- not setting those particular planes to false, or overly complicated code setting back to true.

Since plane and plane2 are publics, you can check them while paused. $$anonymous$$ight help.

avatar image hexagonius · Mar 09, 2015 at 04:26 PM 0
Share

I agree with Owen Raynolds, SetActive should definitely toggle the whole GameObject reliably. If that was an issue I think the forum would go crazy about it. $$anonymous$$aybe you should disable everything except this script and see what happens.

avatar image Boruta · Mar 10, 2015 at 04:38 PM 0
Share

@fafase Yup, scene view is not the game view, that's why you have them both.

@Owen Reynolds @ hexagonious How can I pause in a Build & Run mode. Becuase when I'm in editor mode this issue doesn't appear neither on scene view nor on game view. $$anonymous$$aybe that's why not many people were talking about it(though I found some).

avatar image hexagonius · Mar 10, 2015 at 04:53 PM 0
Share

By Build & Run $$anonymous$$ode, you mean built and run on a mobile device? During game there's only the fake pause by setting Time.timeScale to 0 I would definitely try to achieve the result without code for the device until that works and then look what I had really changed to get that result. Then code it up. Only because it's not working of course.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

My Build won't run properly on Win 8.1 0 Answers

SetActive Button from another scene isn't working in build 0 Answers

Game Camera not scaling correctly when built. 1 Answer

Blank result from build and run 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