Newbie question : Application.targetFrameRate

Here is the code. I put down everything in case you had any tips to give to a total noob . However, the interesting part is the first line of the Start() function.

using UnityEngine;
using System.Collections;

public class Control : MonoBehaviour
{
static int 		SceneWidth 	= 24000;								// Width in pixel of the playable scene
static int 		SceneHeight = 8000;									// Height in pixel of the playable scene
static int XCells = SceneWidth/8;
static int YCells = SceneWidth/8;

static short[]	Surface;											// 1D array containing the height in block of the column
static short[,]	Cell;												// 2D array containing the value of the cell

public GameObject View;												// Returns the Main Camera object
public GameObject TimeGui;											// Returns the Time Gui Text object

public float	TimeInt;
	
	void Start ()													// Executes when this function is first called
	{
	Application.targetFrameRate = 1;								// Makes the maximum frame rate 30 fps
	TimeInt = Random.Range(0,1439);									// Sets TimeInt, which is the time in minutes since midnight
	
	Cell = new short[XCells,YCells];								// Makes Cell a 3000 by 1000 array
	Surface = new short[XCells];									// Makes Surface a 1000 slot array
	
	
////////////////////////////////////////////////////////////////////// Creating the heightmap
	short StartCell = (short)(Random.Range(300,500));				// The first cell is between 301 and 501 blocks from the top (since in an array 0 is the first and not 1)
    short PeakAmount = (short)(SceneWidth/8000); 					// The amount of peaks on the scene; Puts a mountain every 1000 blocks approx
    int   aa = Random.Range(0,201); 								// a number between 0 and 2 pi (modulo 2pi)
	int   bb = Random.Range(0,201); 								// a number between 0 and 2 pi (modulo 2pi)
	int   cc = Random.Range(0,201); 								// a number between 0 and 2 pi (modulo 2pi)
	int   dd = Random.Range(0,201); 								// a number between 0 and 2 pi (modulo 2pi)
	int   ff;														// a number between 0 and 2 pi (modulo 2pi)
    int   ee = 0;
    
    for (ff = 0; ff<XCells; ff+=1)
        {
        Surface[ff] =(short)(StartCell+Mathf.Sin((float)((ff+aa)*1.8/XCells))*150+Mathf.Sin((float)((ff+bb)*PeakAmount*6.283/XCells))*100+
        			 Mathf.Sin((float)((ff+cc)*0.0115))*20+Mathf.Sin((float)((ee+dd)*0.012)*5));
        ee += Random.Range(0,20);									// increments e by a number between 0 and 20, making the smaller mountains more random
        }


////////////////////////////////////////////////////////////////////// Placing the blocks in the cells (Empty, Earth and Rock)
       	for (aa=0; aa<XCells; aa+=1)
            {
             ee = Surface[aa];
             cc = Random.Range(6,10);
                    for (bb=0; bb<ee+cc; bb+=1)
                        Cell[aa,bb] = 2; 							// Add rocks from the bottom to the crust
                    for (bb=ee+cc; bb<ee; bb+=1)
                        Cell[aa,bb] = 1; 							// Fill the crust with earth
                    for (bb=ee; bb<YCells; bb+=1)
                        Cell[aa,bb] = 1000; 						// And add empty up to the top
            }
	}

	
	
	void Update ()													// Executes once a frame
	{
	TimeInt = (float)((TimeInt+0.03)  % 1439);						// Increments TimeInt and resets it to 0 if necessary
	string h;
	h = Mathf.Floor(TimeInt/60).ToString();
	TimeGui.guiText.text = TimeInt.ToString();
	}
	
}

The first line doesn’t seem to work, the fps stays the same no matter what value I put.

Thank you for your time
Tabc3dd

–Eric

The docs specify that the setting is ignored in the editor. I assume that means it’s ignored while running your game from within the editor (as opposed to standalone or in the web-player). Does that explain what you’re seeing?

Why would you set your frame rate to 1 fps anyway? XD

Actually, I was setting it to 1 to really test to see if it worked, maybe my eyes couldn’t spot the difference between 3000 and 30 ^^.

Thank you all for your answers :slight_smile:

30 is pretty choppy, though. Make it at least 60.

–Eric