[FIXED!]Unity lags but uses only 30% of the power that the laptop has!

hi, unity lags. i make a game with a lot of physics. there now 700 physics based objects in the level. i work on a msi gt60 laptop. it has a i7 4810mq processor, up to 3.8 ghz and a nvidia gtx 870m, the second best mobile gpu on the planet. when i check, it uses only 30% of what it is capable of, but it still lags. unity doesnt uses the power ive got?
i have set the qualty level to ultra(all settings maxed out);

does anyone know how to fix this?

thanks in advance,

cody

I’m guessing you’ve got a bottleneck somewhere, and I imagine you’ll need to provide more information before anyone can help you resolve it.

FIXED!

here is a solution:
unity is a 32 bit program. it wont make use of multicore systems. i have 8 logical cores and unity uses 1 of them. the gpu just cant go full power if the cpu is at 1/8 of its max. unity 5 will fix all of this 32 bit stuff, it will become 64 bits, but we have to wait till its released. all you can do is optimize. make sure you have 1 drawcall/object by having 1 material/shader for each obj. use occlusion culling if you have pro. for free, i have some scripts that can boost performance. in the code, center is just a obj that contains settings. here it gets the maximum distance.

var rendered : boolean;
var distance : float;
var player : GameObject;
var maxDis : int = 100;
var center : CENTER;

function Start(){
    player = GameObject.FindWithTag("Player");
    center = GameObject.FindWithTag("CENTER").GetComponent("CENTER");
    maxDis = center.getViewDistance();
}

function Update(){
    maxDis = center.getViewDistance();
    distance = Vector3.Distance(transform.position, player.transform.position);
    if(distance > maxDis){
        dontrender();
    }else{
        render();
    }
}

function render () {
   renderer.enabled = true;
   rendered = true;
   //GetComponent(MeshRenderer).enabled = true;
}
function dontrender() {
   renderer.enabled = false;
   rendered = false;
    //GetComponent(MeshRenderer).enabled = false; 
}

and a kind of the same thing for physics:

var center : CENTER;

var player;
var distance;
var  maxDis : int = 100;
var sleep : boolean;
   
function Start(){
    center = GameObject.FindWithTag("CENTER").GetComponent("CENTER");
    center.addPhysicsObj();
    player = GameObject.FindWithTag("Player");
}

function Update(){
    maxDis = center.getViewDistance();
    distance = Vector3.Distance(transform.position, player.transform.position);
    if(distance > maxDis){
        rigidbody.isKinematic = true;
    }else{
        rigidbody.isKinematic = false;
    }
}

it will deactivate rigidbodys that are far away.

now lets hope unity 5 will come soon and good luck with your optimization!

I think you’re conflating 2 issues. Unity being 32 bit has zero to do with multi-core utilization. 32 vs 64 affects exactly one thing for 99.9% of people: the ability to use more than ~3GB of memory. I think it also makes it faster to work with higher-precision floats, but that affects almost nobody in the game programming space (and I’m not even certain that Unity and/or Mono is going to support that anyway.)

However, Unity 5 may address the issue anyway: separate from the upgrade to 64-bit editor, U5 will include PhysX 3.3, which features among other things improved multicore support for physics.