Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by median · Nov 13, 2013 at 10:59 AM · physicsperformancemove an objectgame editoredit mode

Problem to moving objects with collider in edit mode

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 ?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Wiki

Answer by Aram-Azhari · Nov 13, 2013 at 12:35 PM

There is no direct solution to this.

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[i].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)))
                     go[i].enabled = true;
             }
         }
         catch (System.Exception e)
         {
             Debug.LogException(e);
             EditorUtility.ClearProgressBar();
         }
         EditorUtility.ClearProgressBar();
 
     }
 
         [MenuItem("GameObject/Colliders/Turn off")]
         public static void TurnCollidersOff ()
         {
                 try {
             var go = GameObject.FindObjectsOfType<Collider> ();
                         for (int i = 0; i < go.Length; i++) {
                                 if (!EditorUtility.DisplayCancelableProgressBar ("Turning off colliders", "", i / (float)(go.Length)))
                                         go [i].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<Collider> ();
                         for (int i = 0; i < go.Length; i++) {
                                 if (!EditorUtility.DisplayCancelableProgressBar ("Turning on colliders", "", i / (float)(go.Length)))
                                         go [i].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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by median · Nov 13, 2013 at 04:31 PM

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?

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Aram-Azhari · Nov 13, 2013 at 06:13 PM 0
Share

I'm not sure. What you asked in your first question was to get rid of speed problem. But now you want to disable some objects, but not disable some others.

If some objects are supposed to have their collider disabled all the time and not be turned on, there are two ways to deal with them.

1- One way is to select those objects and remove their colliders (since you're not using them anyway). You can even select them together and remove all colliders from inspector.

2- One other way could be that you create a tag called ignoredcolliders and then select the objects you don't want to be changed and apply this tag. Then use my updated code from the menu but this time the ones that say 'except ignorecolliders'.

btw, The original code works fine without any modification. Are you by any chance using an older version of unity or are you on $$anonymous$$ac? (i'm using 4.2, actually 4.3 from today on pc)

avatar image median · Nov 19, 2013 at 09:09 AM 0
Share

I'm so confused! I think physics must work in play mode not in edit mode! and why the game run smoothly while i cannot move objects in edit mode? the problem gone worst when the scene is become to big. why physics is calculating while we not press play? Your Script worked actually but it really interrupting the level design process.

i set nVidia PhysX in cpanel to CPU or GPU and nothings changed.

( sorry for my bad english )

avatar image Aram-Azhari · Nov 19, 2013 at 09:18 AM 0
Share

You're right, although I wonder if moving all those objects in play mode at the same time would be also slow.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Syncing data from client to server in 5.1 networking 1 Answer

Fastest primitive collider 1 Answer

Temporary disable collision, what's best performance-wise 1 Answer

Physics Casting Performance 1 Answer

Moving Colliders giving me Physics.simulate spikes in Profiler 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges