- Home /
Need help creating a display list for items
I have a basic game where you have a list of items to pick up, as you pick them up I want to erase them off of the list. What would be the best route to take in doing this. I don't even know where to start.
What kind of "list"? A generic List<>
? An array? Do you even talk about scripting? Some code would help i guess...
You should take some time and look up how to use arrays. Go through this site for tons of examples.
$$anonymous$$aybe he is not using arrays or lists, maybe GUIs. But more information is needed.
Sorry for not providing enough information. So I have a search game where a player has a list of items to find in the scene. Once an Item is found the item would be removed from the list as to not have the player forgetting what item they found and still looking for it. $$anonymous$$y guess is I would need some sort of gui to do so but as for the coding I have no idea where to begin.
Answer by aldonaletto · Nov 20, 2011 at 05:58 PM
You could use GUIText: compose the string to display ignoring the items already found - something like this:
var gText: GUIText; // drag the GUIText here from the hierarchy var item1found = false; var item2found = false; var item3found = false; ...
function Update(){ var txt: String = "Items to find:\n"; if (item1found==false) txt += "Item 1\n"; // add the items that were not found yet if (item2found==false) txt += "Item 2\n"; if (item3found==false) txt += "Item 3\n"; ... gText.text = txt; }
Thank you so much this worked great. Just one other question. It is possible to make this scroll-able?
GUIText can't be scrolled; I think you could use GUI.BeginScrollView (http://unity3d.com/support/documentation/ScriptReference/GUI.BeginScrollView.html) to create a scrollable area and add the itens as GUI.Label
Ok I've come across something I didnt think of until it happened. It there a way I can limit the number of lines to display?
What are you using? GUIText, like above, or the GUI system (GUI.BeginScrollView, etc.)? edit your question and post your script, or - better yet - post a new question.
Your answer
Follow this Question
Related Questions
How to create a review of previous updates 1 Answer
Accessing a certain prefab and it's children 1 Answer
Dynamically assign each ui.Text.text in list to the name of objects in another list 2 Answers
Display text on gameobject via user inputs 1 Answer
Creating an ingame LED Panel, with modifyable scrolling text 0 Answers