Ejemplo n.º 1
0
    public void MeshRendererConvex()
    {
        List <MeshCollider> colliders = U_Component.GetChildrenComponents <MeshCollider>(transform, true);

        foreach (MeshCollider collider in colliders)
        {
            collider.convex = true;
        }
    }
Ejemplo n.º 2
0
    public void RemoveAllCollider()
    {
        List <Renderer> renderers = U_Component.GetChildrenComponents <Renderer>(transform, true);

        foreach (Renderer renderer in renderers)
        {
            if (renderer.gameObject.GetComponent <Collider>() != null)
            {
                DestroyImmediate(renderer.gameObject.GetComponent <Collider>());
            }
        }
    }
Ejemplo n.º 3
0
    public void AddMeshColliderToObjHaveRenderer()
    {
        List <Renderer> renderers = U_Component.GetChildrenComponents <Renderer>(transform, true);

        foreach (Renderer renderer in renderers)
        {
            if (renderer.gameObject.GetComponent <Collider>() == null)
            {
                renderer.gameObject.AddComponent <MeshCollider>();
            }
        }
    }
Ejemplo n.º 4
0
    public void MeshRendererToBoxRenderer()
    {
        List <MeshCollider> colliders = U_Component.GetChildrenComponents <MeshCollider>(transform, true);

        foreach (MeshCollider collider in colliders)
        {
            if (!collider.convex)
            {
                if (collider.transform.localScale.x > 0 && collider.transform.localScale.y > 0 && collider.transform.localScale.z > 0)
                {
                    collider.gameObject.AddComponent <BoxCollider>();
                    DestroyImmediate(collider);
                }
            }
        }
    }
Ejemplo n.º 5
0
    public void RemoveAllShaderMaterial()
    {
        if (null == DefaultMaterial)
        {
            DefaultMaterial = new Material(Shader.Find("Standard"));
        }
        List <Renderer> renderers = U_Component.GetChildrenComponents <Renderer>(transform, true);

        foreach (Renderer ren in renderers)
        {
            if (ren.materials.Length < 2)
            {
                ren.material = DefaultMaterial;
            }
            else
            {
                for (int i = 0; i < ren.sharedMaterials.Length; i++)
                {
                    ren.sharedMaterials[i].CopyPropertiesFromMaterial(DefaultMaterial);
                }
            }
        }
    }
Ejemplo n.º 6
0
 void GetObjects()
 {
     hightlightObjects = U_Component.GetChildrenComponents <HighlightableObject>(transform);
 }