Can't disable physics for better performance.

Hey,
I got unity 3 days ago sorry if this is a dumb question but I am trying to do this for a whole day now.

I made a game using MMD models. But I am getting performance issues. When I run the game inside the editors hierarchy tap a script called MMD4MecanimBulletPhysics appears. Using the profiler I figured out when I remove this while running the game my fps are fine and there is no big quality different to see. But since I am only able to see it when I am running the game removing it wont help because after restarting it comes back. I tried blanking MMD4MecanimBulletPhysics.cs but that gives me an error when I want to run the game.
I also tried this http://unity3d.com/learn/tutorials/modules/beginner/scripting/enabling-disabling-components but it didn’t really help since I can only get into the inspector tap of it while running the game and changes while running the games are reseted.

The How am I able to automatically remove it after starting the game or prevent it from starting from the begin with?

I have no clue what that is.

Does this work?

var myComponent = theGameObjectWhereTheComponentAppears.GetComponent<MMD4MecanimBulletPhysics>();
Destroy(myComponent);

EDIT: The actual component name could be different, check the actual class file or maybe your IDE will autocomplete correctly.

Is there anything on the model itself(when importing) for animations?

Thanks for the answers! :slight_smile:

Sorry, I only just started with the code stuff. I can’t figure out how to get the actual name. I tried it like this but it gives the an error

var myComponent = MMD4MecanimBulletPhysics.GetComponent<MMD4MecanimBulletPhysics>();
Destroy(myComponent);

Assets/physics off.cs(13,60): error CS0120: An object reference is required to access non-static member UnityEngine.Component.GetComponent(System.Type)' Assets/physics off.cs(14,17): error CS1502: The best overloaded method match for UnityEngine.Object.Destroy(UnityEngine.Object)’ has some invalid arguments
Assets/physics off.cs(14,17): error CS1503: Argument #1' cannot convert object’ expression to type `UnityEngine.Object’

There is, but if I disable it all other functions like face expression are disabled you cant just choose to disable the physics.

Those aren’t physics of any type in Unity. I don’t know what those are, but they seem to be related to animation.

It would be enough f I would be able to toggle the check-box of the MMD4Mecanimmodel script here. Btw gumiv.9 alt is a .fbx:

I tried with a script like:

using UnityEngine;
using System.Collections;
using IAnimModel                = MMD4MecanimAnim.IAnimModel;

public partial class MMD4MecanimModel : MonoBehaviour, IAnimModel
{
    private MMD4MecanimModel mytoggle;


    void Start ()
    {
        mytoggle = GetComponent<MMD4MecanimModel>();
    }


    void Update ()
    {
        if(Input.GetKeyUp(KeyCode.Space))
        {
            mytoggle.enabled = !mytoggle.enabled;
        }
    }
}

source: http://unity3d.com/learn/tutorials/modules/beginner/scripting/enabling-disabling-components

I was over asked at the parts with private and public I just started learning programming… :frowning: or is this not even the right way at all? Please tell me of you need more information.

Here the top of the MMD4MecanimModel script maybe it helps :

I think you may simply be trying to edit a prefab asset.

First, make sure the game is not running.

Then, I would look in the Project view (quite possibly the bottom view).

Click “All Prefabs”.

Select “MMD4MecanimBulletPhysics”.

Look in the inspector and uncheck the script.

Please let me know if this works.

No sadly it is not showing up as prefab :confused: not even after starting the game. The only place where I can find it is in the hierarchy tab and only when the game is running and when I delete it there I am fine until I restart the game. When I check in the profiler to see where I lose my performance it is called MMD4MecanimBulletPhysics.LastUpdate() (almost 50% performance usage) and when I click on it it links me right to the object MMD4MecanimBulletPhysics that appears in the hierarchy tab.

Pm me, I’ll give you some help for free as I’m curious about this.

Thank you for the offer! I really appreciate all the help from you guys.
I just figured out a way that works for me. In my Project view under plugins\x86 I found a MMD4MecanimBulletPhysics .dll I just deleted this dll. When I strart the game It gives me an error that the dll wasn’t found but the MMD4MecanimBulletPhysics is not showing up in the hierarchy tab anymore and my performance is fine now! :slight_smile: