Some questions that needs answers.

Hi

I have three question that I need help with.

1: Is there any time commando like in C++? Let’s say I have a function, so when a function is executed I want some things to happen. And after the time that was inputed in that commando, the things under this commando (in the script) will be executed.

2: How can I make a script that creates a save file, and in the save file there will be saved intiatures, floats, boolean? Or is there a way to save in a better way?

3: Whay is the best way to create a 2D crosshair that the weapon follows? Because I can make it so the weapon/gun targets the crosshair. Or is there a better way to do it.

1:

Scheduling events to occur after a specific amount of time has passed is done using Coroutines, and the “WaitForSeconds(float)” yield instruction in particular. Study this page:

http://unity3d.com/support/documentation/ScriptReference/index.Coroutines_26_Yield.html

2:

Saving single variables is efficiently and easily done using PlayerPrefs, study them here:

http://unity3d.com/support/documentation/ScriptReference/PlayerPrefs.html

If you need more complicated data written to a file, you should resort to the various IO classes in .Net. It’s possible you can format it as a string and put it all in a file with a single line of code using File.WriteAllText, but this depends largely on your specific use scenario.

3:

That question has been asked a gazillion times. Try to google for “Unity3d Crosshair”, and you’ll find plenty of hits. There is even a youtube tutorial for that particular purpose here:

http://www.youtube.com/results?search_query=Unity3d+crosshair&oq=Unity3d+crosshair&aq=f&aqi=&aql=&gs_sm=e&gs_upl=346l3746l0l3986l19l16l1l9l10l0l161l497l4.2l6l0