24m tri 50m verts from 300 trees

hello.

So i wrote this script to spawn choppable trees from a prefab and finally got it working correctly. Now i am running into problems when trying to optimize the forest of only 300 trees. I checked static in the inspector and it did not help at all I am not saving anything while trying to batch them together. what else can i do to get these numbers down. I am currently getting only 3 to 6 fps when i look at a section of trees.

could it be the tree model that I am using to high of a poly count? 24m triangles and 50m verts are big numbers.
ya im getting millions that’s not a typo.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class RandomizeObj : MonoBehaviour {
	public Transform obj;
	public Vector3 postiion;
	public GameObject objspawned;
	public int totalobjs;
	public float ObjectsetWidth;
	public float ObjectsetLength;
	public float respawntime = 3600.0f;
	public float respawn = 3600.0f;
	//respawn object if destryed after 60minutes - 3600 Seconds - 3600000.0f milliseconds


	void Start () {

		int spawned = 0;

		while (spawned <= totalobjs) {
			Vector3 position = new Vector3 (transform.position.x + Random.value * ObjectsetWidth, transform.position.y, transform.position.z + Random.value * ObjectsetLength);

			RaycastHit hit = new RaycastHit ();

			if (Physics.Raycast (position, Vector3.down, out hit)) {

				Transform newObj = (Transform) Instantiate (obj, hit.point, Quaternion.identity);
				newObj.transform.SetParent (transform);

				newObj.name = gameObject.name + "_Obj" + spawned;
			}
			spawned++;
		}



	}
	void Update() {
		respawntime -= Time.deltaTime;
		if (respawntime < 0) {
			CheckForTrees ();
		}
	}
	void CheckForTrees() {
		int i = 0;
		while (i < totalobjs) {

			Vector3 position = new Vector3 (transform.position.x + Random.value * ObjectsetWidth, transform.position.y, transform.position.z + Random.value * ObjectsetLength);

			objspawned = GameObject.Find(gameObject.name + "_Obj" + i);

			if (objspawned == null) {
				
				RaycastHit hit = new RaycastHit ();
				if (Physics.Raycast (position, Vector3.down, out hit)) {
					Transform newObj = (Transform)Instantiate (obj, hit.point, Quaternion.identity);
					newObj.transform.SetParent (transform);

					newObj.name = gameObject.name + "_Obj" + i;
					Debug.Log ("Not Found Object at " + i);
				} 
			}

			i++;
		}
		respawntime = respawn;

	}
}

That’s 80,000 tri per tree. To put things in perspective, character models are typically the most complex geometry a game will handle and a quick search suggests AAA-models for recent games range between 10-40k. Keeping in mind, we’re talking main characters, which the game is only expected to render a couple of at any given time.

So yes, it’s extremely likely that a forest of 80k-tri trees is killing your framerate. If they’re your model, consider some heavy optimization. If not, I might suggest looking for a substantially lighter mesh.

Oh it is the forest for sure. when i run the game with no trees that is just the terrain and a single player and no other objects instantiated i get 100+fps then as soon as i add them back in and look towards them fps drops. Ill be on the look out for some low poly trees i guess. :confused: Or have a crack at making my own low poly trees in blender. I was trying to get away from modeling and focus on getting the majority of the code done but it looks like ill have to spend some time in blender before i can go any farther. thx for the input.