Long time no see UnityAnswers.
So I have a script that calls functions at set times, that works fine. What I want to happen is once that function is called it feeds int values into other scripts however I can’t work out what the right syntax. On an empty object I have “levelControl.cs” that I type in the int values I want to pass on to the 2nd script “WallSection.cs” attached to a gameObject called “WallSpawnPoint”
So in the “levelControl” script I have this…
void GroupNumber0()
{
//Talk too WallSection. and set NumberOfWalls to 10
GameObject.Find ("WallSpawnPoint").GetComponent<WallSection>().SetNumberOfWalls();
}
And on my “WallSection” script I have…
public void SetNumberOfWalls(int NewNumber)
{
NewNumber = NumberOfWalls;
}
I’ve never been able to work out how to feed an int from one script into another as you can see despite checking numerous tutorials. Bizarrely I understand how to pass a Vector3 but not a simple int.
So ultimately, I want to set the “NumberOfWalls” int in the script “WallSection.cs” via the script “levelControl.cs”
What’s the correct syntax and correct usage of the function brackets? Any help is appreciated!