Hi, so I want to know if there’s a way to find a variable by using the value of another variable.
So it’s not very often I come here for help, and I am really stuck on how to do this without getting complicated with lists/arrays or making some really messy code.

So the image above is the example of what I mean to do with the code.
Index being a simple integer and the variable, being called, being a bunch of boolean named “_screw1”, “_screw2”, “_screw3”, etc.
What you are wanting to do is not valid C#, rather than have a bunch of properties on “GameData” for “_screw1”, “_screw2” you would have an array of screws, each will then be given an index that you could iterate over.
You should also use PascalCase for naming classes. e.g. gameData should be GameData
private void OnTriggerEnter(Collider other)
{
var screws = ScriptManager.GetComponent<GameData>().screws;
for (int i = 0; i < screws.Length; i++)
{
screws *= false; // Do something here with each screw*
}
}
GameData would have something like this:
public bool[] screws;
// or
public Screw[] screws;