how to call score method from different class ???

Hi
i have asked this question before but didn’t get the wanted code , i have a game with multible spawners and with game score , the game will start with 1 spawner , for example if the score becomes 100 , the second spawner will work or start spawning , the problem in my code is that the Score is exist in a object trigger to calculate the objects score which hit that trigger , i think i have 2 solution for this but i want some one to help me with coding it
1- in the same object trigger i have to put if statement , if score >= 100 , activate Spawner2 ( Spawner2 should be already inactive).
2- in each spawner , i have to call the Score method from the object trigger class , for example :

void SpawnObject() {

		if (Score==10){
.
.
.
.
}
}

but i dont know how to call the score method from that object trigger :frowning: , so please if any one know how to code any of those solution , please help me with this

Thanks

please any one can help ??

I think what you need to apply is a system of managers and delegates. Meaning, you have one manager for any sub members. And in turn these sub members, may have sub members themself.

As long as I have access to the objects before run, I use the scriptName as a variable. Any object now, with this script can fill this slot. In turn, this script, can now access the object with scriptName.

public scriptName scriptData;


void doSomething(){
scriptData.DoThis();
scriptData.someVariable = thisValue;

Thx renman , actually im looking of someone can code one of the solutions i’ve suggested , i think its easy to do like so , but im new in unity

Yep, it’s pretty easy. Only takes a couple of years to get good at programming, good luck!