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 Reedex · Apr 06, 2018 at 07:30 AM · gameobjectpublicinactive

hi, I have public Gameobject,added via inspector when i move out from location(scene) and come back,the public is not there anymore, i cant use Gameobject.Find since its inactive.

i tried to make "active manager" and have all objects that dont need to be in game from beggining underneath and instead of setting it active underneath desired gameobject i changed its parent while keeping it activated.but its not working..is this what static private get set is for? thanks.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by megamika2 · Apr 06, 2018 at 07:57 AM

@Reedex Try to make it active and as soon as is it founded with GameObject.Find just use gameObject.SetActive(false).

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 Reedex · Apr 06, 2018 at 08:17 AM 0
Share

so this is one of the things that should be done while loading right?

avatar image megamika2 Reedex · Apr 06, 2018 at 12:15 PM 0
Share

Yes in the void Start() function

avatar image
0

Answer by Gordrik · Apr 06, 2018 at 08:30 AM

Using find is a bad idea, cause it is searching whole scene for an object, which is expensive, and yes, it can't find inactive objects.


What you could do is creating an empty, make it singleton, put in to it inactive objects, and get access to them by using .instance.GetComponentInChildren();

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 Reedex · Apr 06, 2018 at 09:27 AM 0
Share

the story goes like this, i have a gameobject called quests(disabled unitl you open it obvoiusly), its a 2d screen with gridlayout,with a bunch of Texts.all disabled from the begining. if i go and talk with npc , it says in one of the dialogue options,. gameobject.find "quest1".setactive.true , that of course doesnt work. i am not yet familiar with singletons and instance, so i'll take a look.

avatar image Gordrik Reedex · Apr 06, 2018 at 11:26 AM 0
Share

singletons are quite basic, and make accessing a class much easier, but use it only on classes like managers where you have only one on whole scene, or even game.

This looks well explained: https://www.youtube.com/watch?v=CP$$anonymous$$Agyp8cno

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

114 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 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 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 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 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 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

How to assign a gameobject to a script that is added dynamically 1 Answer

How to make a public game object array inside an array (or 2D array) that can drag and drop to fill? 1 Answer

Why is text ui cant be static ? 0 Answers

Unity 5 And Attaching Game Objects To Inactive Objects 1 Answer

Possible to make GameObject.GetComponentInChildren() check inactive objects? 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