Game objects in project that have Collider and Rigid body can move ver slow in editor mode (scene)
I have new PC : i7 3770 , 8 GIG Ram, Geforce GTX 650, Win 8 - 64 bit.
same project work smooth with my mac mini 2011
when I moving that objects CPU fan start working too hard.
I turn the physic component of game objects off and they moving smoothly.
please help me with that problem.
// is there a way to turn off physic calculation in edit mode ?
However, I have written a little code to turn the colliders off so you can move stuff faster. Once you’re done, turn them on again.
Copy the content of this code inside a file called ColliderTool.cs. AND the file should be inside a folder called Editor. If you don’t see a folder with that name, just create one.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.Linq;
public class ColliderTool : Editor
{
[MenuItem("GameObject/Colliders/Turn off except ignoredcolliders")]
public static void TurnCollidersOffExceptIgnored()
{
try
{
var go = GameObject.FindObjectsOfType<Collider>();
go = go.Where(g => g.tag != "ignoredcolliders").ToArray();
for (int i = 0; i < go.Length; i++)
{
if (!EditorUtility.DisplayCancelableProgressBar("Turning off colliders", "", i / (float)(go.Length)))
go*.enabled = false;*
}*
}*
catch (System.Exception e)*
{*
Debug.LogException(e);*
EditorUtility.ClearProgressBar();*
}*
EditorUtility.ClearProgressBar();*
}*
[MenuItem(“GameObject/Colliders/Turn on except ignoredcolliders”)]*
public static void TurnCollidersOnExceptIgnored()*
{*
try*
{*
var go = GameObject.FindObjectsOfType<Collider>();*
go = go.Where(g => g.tag != "ignoredcolliders").ToArray();*
for (int i = 0; i < go.Length; i++)*
{*
if (!EditorUtility.DisplayCancelableProgressBar("Turning on colliders", "", i / (float)(go.Length)))*
* [MenuItem(“GameObject/Colliders/Turn off”)]* * public static void TurnCollidersOff ()* * {* * try {* * var go = GameObject.FindObjectsOfType ();* * for (int i = 0; i < go.Length; i++) {* * if (!EditorUtility.DisplayCancelableProgressBar (“Turning off colliders”, “”, i / (float)(go.Length)))* _ go .enabled = false;
* } } catch (System.Exception e) { Debug.LogException (e); EditorUtility.ClearProgressBar (); } EditorUtility.ClearProgressBar ();*_
* }*
* [MenuItem(“GameObject/Colliders/Turn on”)]* * public static void TurnCollidersOn ()* * {* * try {* * var go = GameObject.FindObjectsOfType ();* * for (int i = 0; i < go.Length; i++) {* * if (!EditorUtility.DisplayCancelableProgressBar (“Turning on colliders”, “”, i / (float)(go.Length)))* _ go .enabled = true; * } } catch (System.Exception e) { Debug.LogException (e); EditorUtility.ClearProgressBar (); } EditorUtility.ClearProgressBar ();*_
* }* } Now you can access the turn off and turn on commands from the menu GameObject/Colliders. If you want some objects to be left alone all the time, just tag them as ‘ignoredcolliders’. I hope this helps.
Thanks Aram Azhari, I really appreciate your help
after a few changes at lines 13 and 31 of your script to this:
Collider go = FindObjectsOfType(typeof(Collider)) as Collider;
that worked for me.
but I really worry about object that have disabled collider that with this script we turning them to Available. I don’t know. It’s a big enough project to losing them. is there a way to avoid that?