I need to pass some variables (lets say 30 or 40, mostly Int) from one script to another. But not just on "Start", but whenever the user hits a "Menu" button.
I could use PlayerPrefs.SetInt and PlayerPrefs.GetInt to write/read those variables or thatd be too slow comparing to the usual method of passing parameters (lets say fill an array with those ints or something and pass it to the other script when the user hits the "Menu" btn) ??
I dont actually NEED these data to be persistent, but you never know..... if the two approaches are similar regarding the speed, Ill prefer the PlayerPrefs road..
Thks in advance!
Unless you are having some issues with speed, I wouldn't even worry about it. If it's just menus where you need to pass parameters like this I see no reason why you can't use the Get() and Set() functions. The function itself may be "slow" in a continuous update loop, but for a one time click event it should be fine.
There is a currently existing bug where activating the Keyboard view in Unity iOS applications can result in a severe increase in PlayerPrefs write times.
In general, you can optimize your PlayerPrefs call by writing to your own hashtable and then loading and flushing all values from device playerprefs at application launch and quit.