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 question was closed Jan 29, 2015 at 12:29 AM by Ujean917 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Ujean917 · Jan 26, 2015 at 10:09 PM · c#setactive

GameObject not showing up when set active.

Hello, I am trying to make a gameobject appear when set to active but its really confusing me why it isn't doing just that.

I have it set to active in the scene and in script set to unactive in the start method. With the script its supposed to tell the game object to reappear but its not. The compiler reaches the Debug.Log ("Wave0TutorialEvent1 Should be visible"); so I don't understand why it is not appearing.

I would really like for your advise on how I should change this and what is wrong. Thanks in advance.

Here's the code I'm messing around with.

 using UnityEngine;
 using System.Collections;
 
 public class Wave0TutorialGUIEnabler : MonoBehaviour 
 {    
     private bool wave0TutorialEvent1Status;
     private bool wave0TutorialEvent2Status;
 
     private GameObject wave0TutorialEvent1TextBox;
 
     void Start()
     {
         wave0TutorialEvent1TextBox = GameObject.Find("Wave0TuturialEvent1TextBox");
         wave0TutorialEvent1TextBox.SetActive (false); //In scene is active but is set to unactive when game is started.
     }
 
     void Update()
     {
         if (wave0TutorialEvent1Status == true) 
         {
             wave0TutorialEvent1TextBox.SetActive (true);
             Debug.Log ("Wave0TutorialEvent1 Should be visible");
             Invoke ("WaitForDialogue", 10.0f);
             wave0TutorialEvent1TextBox.SetActive (false);
             wave0TutorialEvent1Status = false;
         }
     }
 
     void WaitForDialogue()
     {
 
     }
 
     void Wave0TutorialEvent1 (bool status) 
     {
         Debug.Log ("Activating event");
         wave0TutorialEvent1Status = status;
     }
 }

Comment
Add comment · Show 2
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 Owen-Reynolds · Jan 26, 2015 at 10:18 PM 0
Share

Pause and check the object in the Inspector. It might be active, but just not visible. See if you can move it to where it is. Or it may have an inactive parent. Click around to try to "turn it on." $$anonymous$$ake sure the variable waveTutorialEvenBox is pointing where it should.

avatar image Ujean917 · Jan 26, 2015 at 10:31 PM 0
Share

I tried that but to no avail. The Gameobject is still inactive after the fact that it should be active. The parent aren't put in inactive by accident either and the gameobject is pointing in the right direction so that the normal isn't facing the opposite direction of the camera.

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by Chris333 · Jan 26, 2015 at 10:14 PM

Hi,

 void Update()
      {
          if (wave0TutorialEvent1Status == true) 
          {
              wave0TutorialEvent1TextBox.SetActive (true);
              Debug.Log ("Wave0TutorialEvent1 Should be visible");
              Invoke ("WaitForDialogue", 10.0f);
              //wave0TutorialEvent1TextBox.SetActive (false);
              wave0TutorialEvent1Status = false;
          }
      }

You set it active and than directly again to false.

Comment
Add comment · Show 7 · 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 Ujean917 · Jan 26, 2015 at 10:17 PM 0
Share

Does the invoke not matter in this case? I put the invoke there so there would be time stalled so the game object would last longer.

avatar image Chris333 · Jan 26, 2015 at 10:28 PM 0
Share

No, it does only invoke the method which you hand over as string parameter.

avatar image Ujean917 · Jan 26, 2015 at 10:45 PM 0
Share

What would you suggest I do to make the gameobject last longer before disappearing.

avatar image Chris333 · Jan 26, 2015 at 10:47 PM 0
Share

Did you tried what i posted above? Is it now showing up?

avatar image Ujean917 · Jan 26, 2015 at 10:51 PM 0
Share

It is showing but I don't want it to stay visible forever.

Show more comments

Follow this Question

Answers Answers and Comments

19 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How to Use DontDestroyOnLoad on my C# Script? 1 Answer

Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer

Select Car - Multiple prefabs 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