- Home /
Prefab Puzzle
https://hastebin.com/opoginoxaq.cs
Here's my code. I'm trying to first get the input from an input field and then delete the gui which was instantiated in another script as a prefab.
The problem is, nothing in my input "return" part of the script appears to be executing. Someone in irc told me to use the Input Field's OnEndEdit event instead of waiting for enter to be pressed. I guess I could do that but this seems simpler.
One of my questions is, how do I get at the input field inside the prefab? I can't drag that from the prefab to the slot in the game object where i attached my script, so I have to do that in code, which someone said is possible, but I don't know how to do it. I can drag the transform to inputbox1, no problem, just can't get at the input field to drag it to inputbox. As I said, though, nothing in this script appears to be executing correctly. So I'm asking if anyone has a fix for it?
Answer by gibberingmouther · Jan 31, 2017 at 12:51 AM
https://hastebin.com/canipaweyu.cs
Figured it out with the help of the irc channel. To get around the problem of not being able to get at the input field, I just put that prefab back in the hierarchy. Not an ideal solution, as I wanted to do it the proper way in code, but it works for my situation.
Your answer
Follow this Question
Related Questions
How can i add all the prefabs in the assets directory and sub directories to List or Array ? 0 Answers
How do I initialize TreeView in Unity 2019.3 ? -1 Answers
How to change a float value with UI buttons,How Can I control a character with UI buttons? 1 Answer
How come I cannot set my prefab game component into a script public variable? 1 Answer