- Home /
Load a GameObject that is outside of script and set it active at the same time
Hi, I am trying to make it so that when the player dies, text (which is disabled up to their death) saying that they died is enabled. While I know how to access GameObjects in scripts, and I know how to set them active, I don't know how I can do both of these at the same time. No matter what syntax I use, it always returns some error. Would anyone mind helping me out? Thanks!
Answer by ShadyProductions · Aug 07, 2017 at 02:22 PM
If you know how to access GameObjects in scripts, then all you have to do is set the .enabled to true? What? Your explanation is confusing.
public GameObject yourobject; //set this in the inspector
yourobject.enabled = true;
Sorry, I'm a bit of a noob when it comes to Unity's C# library. But thanks for the answer!
Your answer
Follow this Question
Related Questions
error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer 3 Answers
If you disable a gameobject, does an InvokeRepeating loop end or pause? 3 Answers
How to display a file name on a text field c# 1 Answer
gameobject.setActive(true) || (false) hiccups game for 3 to 5 seconds 4 Answers