okay i am finally going to start my dreams and create my first game on google play so excited
i have some trouble with this code below i am trying to check each member of my list in an if statement if anything is similar in that list with a text
{
public List<string> words
int index =Random.Range(0, words.Count);
// random does not work
if (letterBox.text == words[index] ) ;
{
// do something
}
}
now i all ready have a list called words but i need something similar to the random.range but instead of comparing at random comparing it one by one till it get something similar or does not
also if you have any tips about launching your first game what to do what to expect
adding in app purchases
so now to add more context in words list they are 20 or so words and the player has to guess a word from the list
I think before going too far, it’s definitely worthwhile doing some preliminary learning of C# itself, or do some more guided learning: Junior Programmer Pathway - Unity Learn
In any case, this is where using loops comes into place. The most basic being the for-loop:
public class CollectionExample : MonoBehaviour
{
public List<string> words;
private void Start()
{
int count = words.Count;
for (int i = 0; i < count; i++)
{
string word = words[i];
Debug.Log(word);
}
}
}
I suggest making extremely small steps because if you make bigger steps and the first one has an issue, you can get very confused thinking the issue is in subsequent steps.
Also, as Spiney points out, do a little bit of C# learning. This three-bucket framework can help you think about what you are learning:
Your learning will be (largely) broken into broad areas of knowledge.
You may find these main buckets helpful to organize your learning:
C# language syntax (organization, structure, grammar, punctuation)
the .NET API (all the tools that come with C#: lists, dictionaries, file IO, etc)
the Unity API (everything in the using UnityEngine; namespace)
Beyond that mechanical stuff comes the interesting stuff: how to actually solve real world problems.
I like this guy’s tiny micro-step approach… it can really help you stay out of trouble: