Beispiel #1
0
        private object OnProBuilderize(object arg)
        {
            GameObject[] gameObjects = Editor.Selection.gameObjects;
            if (gameObjects == null)
            {
                return(null);
            }

            for (int i = 0; i < gameObjects.Length; ++i)
            {
                MeshFilter[] filters = gameObjects[i].GetComponentsInChildren <MeshFilter>();
                for (int j = 0; j < filters.Length; ++j)
                {
                    PBMesh.ProBuilderize(filters[j].gameObject);
                }
            }
            return(null);
        }
Beispiel #2
0
        private object OnProBuilderize(object arg)
        {
            GameObject[] gameObjects = Editor.Selection.gameObjects;
            if (gameObjects == null)
            {
                return(null);
            }

            Transform[] transforms = gameObjects.Select(g => g.transform).ToArray();
            gameObjects = gameObjects.Where(g => !transforms.Any(t => IsDescendant(t, g.transform))).ToArray();

            for (int i = 0; i < gameObjects.Length; ++i)
            {
                Vector3 scale    = gameObjects[i].transform.localScale;
                float   minScale = Mathf.Min(scale.x, scale.y, scale.z);
                PBMesh.ProBuilderize(gameObjects[i], true, new Vector2(minScale, minScale));
            }
            return(null);
        }