I am trying to call the same function on different scripts.
I place all scripts into an array and then try to call that function by iterating trough all scripts.
private var SavableScripts : List.<MonoBehaviour> = new List.<MonoBehaviour>();
public function SaveNewGame() : void
{
5. for ( var i : MonoBehaviour in SavableScripts );
{
i.OnSaveGame();
}
10. // 2do hide saving icon
}
This does not seem to work, it can’t find that member function OnSaveGame().
How can I accomplish this, do I have to look into generic functions using c# instead of this unityscript attempt of mine?
I do not wish to call BroadcastMessage and the like because I will not know when saving is completed that way.