i need to create a script that compares the data of other scripts and tells me which is the highest value.
the script is the same ut in differents prefabs.
what I did was a script in each prefabs that say the value and another script that search the prefabs then the script and then the value to use.
transform.GetChild(1).GetComponent().the value;
but this doesnt worked.
Cannot access non-static property ‘transform’ in static context
how can i do the script
Based on that error it sounds like you’re trying to put that code in a static method. That will not work. A static method is not tied to a specific instance of your class. So when you write transform.GetChild(1).GetComponent<the script>().the value it can’t know which transform to get the child at index 1 of, because a static method is not tied to a specific instance of your script.
The solution is to put this code in a normal, non-static method.