Reducing Lag in Game?

So Iv been working on my game for some time now and lately im starting to realize its becoming really laggy. I was wondering if there is any way to reduce this lag?
My level only has 3 houses, my main character, and the base area for the player to walk on and houses to stay on. I was wondering if I scale down the whole level and everything inside of it like objects, houses, everything, down to really really small size, would that reduce the lag in my game?

I am not using High poly models, Im only using the low poly models iv been working on, however they are all FBX files. But really my game is pretty much like a N64 game, In terms of Models, textures, and animations. but still it lags for some reason, and I am becoming worried because I still need to add a lot more things to the level such as other characters and more objects, and collision features and other scripting stuff. Lagging at an early stage is not a good sign.

I wouldn’t worry too much, I’m sure you can get this resolved and add everything you want especially if it’s not graphics intensive. You probably just need to adopt more efficient scripting and graphics practices.

If you have Unity Pro the profiler built into Unity is good and can give you great insight into what is bogging you down. Barring that you can find some information about doing graphics optimizations here, and there is some information about optimizing scripts here.

In Mobile Development, change the materials to mobile shaders. This really can improve framerates but the textures look not as good

By the way, I just fixed my lag by about 5 fps to about 50 fps. I had the annoying little error that says “NullReferenceException…” This was because I had to put a gameobject and make it into a prefab and then assign it to the other prefab variable.

THIS SHOWS THAT WHEN YOU FIX ERRORS IT CAN REALLY IMPROVE FRAMERATES

If anyone is still having this problem I just finished making my game run smoother by changing my Update functions to contain as little intensive work in them as possible. Here’s what I mean, let’s say that you control your character’s inputs through the update function. If you ever want to take control away from your character (for a tutorial or cutscene for example) it might seem reasonable to set up a boolean canPlayerMove and set it to true or false depending on the situation. Your script would look something like this:

    void FixedUpdate () {
		if (canPlayerMove = true) {
			if(Input.GetKey (KeyCode.A)) {
				transform.position += Vector3.left * movementSpeed * Time.deltaTime;
			} else if (Input.GetKey (KeyCode.D)) {
				transform.position += Vector3.right * movementSpeed * Time.deltaTime;
			}
		}
	}

	// This function let's the player move
	public void PlayerStart () {
		canPlayerMove = true;
	}

	// This function prevents the player from moving
	public void PlayerStop () {
		canPlayerMove = false;
	}

However, now your Update method is checking whether or not canPlayerMove is true every single frame. Stuff like this is what will lag your game, so finding creative solutions to these types of problems is going to be what helps you. A solution to this problem might be turning the canPlayerMove boolean into an integer that is either 1 or 0 and multiply it to the transform.position. Here’s what that would look like:

	void FixedUpdate () {
		if(Input.GetKey (KeyCode.A)) {
			transform.position += Vector3.left * movementSpeed * Time.deltaTime * canPlayerMove;
		} else if (Input.GetKey (KeyCode.D)) {
			transform.position += Vector3.right * movementSpeed * Time.deltaTime * canPlayerMove;
		}
	}

	// This function let's the player move
	public void PlayerStart () {
		canPlayerMove = 1;
	}

	// This function prevents the player from moving
	public void PlayerStop () {
		canPlayerMove = 0;
	}

}

The resulting code is functionally the same, but now you are checking for less things and your game would run more smoothly. I hope this helps if anyone needs it.

PS: This theoretical setup I explained was actually something in my game and after making these changes it heavily improved the performance.

I’m glad you found your problem was just in the editor! anyways looks like others are following this question. So i thought i would add for anyone who does have a level too large. First of all scale does not matter! what matters is the number of faces and amount of textures sent to the video card! A cube as small as a rock or scaled large as a building requires the same amount of processing power to display!

so generally you never use more faces in your models than needed and as less textures as possible.

Unity has something called batching which by default is running during your game. it does help with ignoring textures not in use and reducing shader quality at distances but Its really not enough for a really big world.

there is a technique called LOD which uses simpler meshes at a distance.
https://docs.unity3d.com/Manual/LevelOfDetail.html

there is also a setting to reduce texture quality at a distance
https://docs.unity3d.com/ScriptReference/Texture-anisoLevel.html

of course you can do stuff with code for your game too.
an example would be simply disabling game objects or complex meshes when you know they are out of view with code. Such as the detailed inside of a building or room when the user is outside!

Just to add another performance tip, while developing I’m often a bit liberal with the debug.log calls, outputting different values where I’m trying to debug my code, and then sometimes not immediately disabling them when issues get figured out with the intention of cleaning up all these log calls before release. While trying to figure out my own performance problems though I discovered that Debug.Log outputs are actually very expensive, much more than I expected. A few Debug.Log calls per update can bring your game to a crawl.