Adjust your Clipping Planes
Adjust your camera clipping planes, get the far range as small as possible. In my case, 10 is perfect but average is probably around 100-300. It all depends on the size of your room and objects.
Comparing fps just from clipping changes
Here you can see the clipping plane is too big for the scene and I have noticeable low fps because of it.
After adjusting to the scene correctly by lowering my clipping plane value my fps gets a nice boost.
Disable objects until you need them.
Especially objects with intense shaders such as mirrors. Use an object manager to toggle the object on & off as needed. This also has the benefit of being a way to pool objects such as bullets that can slow a game down with massive creation or destruction, toggling them on or off saves a lot of framerate.
The framerate for the mirror spawners above dropped below 10fps, beware of intense objects!
I send the mirror a player reference from a general manager that contains a reference to every object in my scene, in my case this is natural for this style of work but for more static based rooms actually built in the editor, a simple manager will do.
I have a parent of the mirrors turn them on when the player is close and turn them off when the player is far. This helps a great deal with framerate, and as of yet comparing distance has not caused me any problems
I send the mirror a player reference from a general manager that contains a reference to every object in my scene, in my case this is natural for this style of work but for more static based rooms actually built in the editor, a simple manager will do.
I have a parent of the mirrors turn them on when the player is close and turn them off when the player is far. This helps a great deal with framerate, and as of yet comparing distance has not caused me any problems
Use Coroutines when possible to help save framerate.
Not much else to say here, it simply helps to break intensive programming and has the benefit of being a great way to create a timer :)
void Start()
{
StartCoroutine("RepeatedTimerI");
}
IEnumerator RepeatedTimerI()
{
Debug.Log("I'm done!");
yield return new WaitForSeconds(5);
}
{
StartCoroutine("RepeatedTimerI");
}
IEnumerator RepeatedTimerI()
{
Debug.Log("I'm done!");
yield return new WaitForSeconds(5);
}
You can even stack coroutines inside themselves!
IEnumerator blinkAtRandomI()
{
while (true)
{
for (int i = 0; i < eyelidTextures.Length; i++)
{
//go through each texture
StartCoroutine("OneBlink");
//wait a certain amount of time
yield return new WaitForSeconds(timeBetweenFrames);
}
//choose a random amount of time to wait
var t = Random.Range(timeUntilNextBlink.x, timeUntilNextBlink.y);
yield return new WaitForSeconds(t);
}
}
{
while (true)
{
for (int i = 0; i < eyelidTextures.Length; i++)
{
//go through each texture
StartCoroutine("OneBlink");
//wait a certain amount of time
yield return new WaitForSeconds(timeBetweenFrames);
}
//choose a random amount of time to wait
var t = Random.Range(timeUntilNextBlink.x, timeUntilNextBlink.y);
yield return new WaitForSeconds(t);
}
}
Bonus: Check your objects are built correctly
Set your normals & tangents to import. In my case it threw an error because I somehow scaled an aspect of my object negatively so I had to go back and adjust the model, I just had to remove the - sign in the scale.
This will also reduce the amount of extra verts Unity likes to create when importing a model.
This will also reduce the amount of extra verts Unity likes to create when importing a model.