-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleWindow.cs
More file actions
38 lines (32 loc) · 898 Bytes
/
ExampleWindow.cs
File metadata and controls
38 lines (32 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class ExampleWindow : EditorWindow {
Color color;
[MenuItem("Window/Coloriar Objecto")]
public static void ShowWindow()
{
EditorWindow.GetWindow<ExampleWindow>("Color");
}
void OnGUI ()
{
GUILayout.Label("Seleciona el Color del Objeto", EditorStyles.boldLabel);
color = EditorGUILayout.ColorField("Color", color);
if (GUILayout.Button("Coloriar"))
{
Colorize();
}
}
void Colorize()
{
foreach (GameObject obj in Selection.gameObjects)
{
Renderer renderer = obj.GetComponent<Renderer>();
if (renderer != null)
{
renderer.sharedMaterial.color = color;
}
}
}
}