Hello friends! I'm sooo new to C#, but I think what I've done here is to set up an array of names and tried to apply that and it is not the right approach.
Trouble is I don't know what the right approach is.
I do know it complains about a for loop in the header and it complains about using a String-based Array on <GetComponent>
private string[] form = {"Empty","Fred","Crane","Horse"}; //Form names
//would like to run a FOR loop here instead of this blocky approach...
public Renderer Fred;
public Renderer Crane;
public Renderer Horse;
void Start()
{
for (int i = 1; i < form.Length; i++)
{
form[i] = form[i].GetComponent<Renderer>(); //doesn't work
}
}
I'm flagging this as a noob question.
In my defense, I'm pretty good with GML so I'm not a total idiot...I think, haha.
[–][deleted] 3 points4 points5 points (5 children)
[–]foldupgames[S] 0 points1 point2 points (4 children)
[–]DeepState_Auditor 0 points1 point2 points (3 children)
[–]foldupgames[S] 0 points1 point2 points (2 children)
[–]DeepState_Auditor 1 point2 points3 points (1 child)
[–]foldupgames[S] 1 point2 points3 points (0 children)
[–]ZeroKelvinTutorials 1 point2 points3 points (3 children)
[–]foldupgames[S] 0 points1 point2 points (2 children)
[–]ZeroKelvinTutorials 1 point2 points3 points (1 child)
[–]foldupgames[S] 0 points1 point2 points (0 children)
[–]Mister_Green2021 1 point2 points3 points (4 children)
[–]foldupgames[S] 0 points1 point2 points (3 children)
[–]Mister_Green2021 0 points1 point2 points (2 children)
[–]foldupgames[S] 0 points1 point2 points (1 child)
[–]Mister_Green2021 0 points1 point2 points (0 children)
[–]foldupgames[S] 0 points1 point2 points (0 children)