// Method used to display the prefab placement tools. private void DisplayPrefabSpawner() { /* DO YOUR CODING HERE FOR UI */ //We use this checker to update values each time the user modifies a value EditorGUI.BeginChangeCheck(); //Enable physics tmp_enable_physics = EditorGUILayout.Toggle("Enable physics", tmp_enable_physics); //Display a dropdown list with all layers, and get the selected one. layerNames = new List <string>(); for (int i = 0; i <= 31; i++) { string layerName = LayerMask.LayerToName(i); if (layerName.Length > 0) { layerNames.Add(layerName); } } options = new string[layerNames.Count]; for (int i = 0; i < layerNames.Count; i++) { options[i] = layerNames[i]; } layerSelected = EditorGUILayout.Popup("Layer filter", layerSelected, options); // AssetObject to attach to parent // parentObjectTransform = EditorGUILayout.ObjectField("Attach Parent", parentObjectTransform , typeof(Transform), true) as Transform; parentObject = EditorGUILayout.ObjectField("Attach Parent", parentObject, typeof(GameObject), true) as GameObject; // Build the necessary UI to display the transform settings tmp_position = EditorGUILayout.Vector3Field("Position", tmp_position); tmp_rotation = EditorGUILayout.Vector3Field("Rotation", tmp_rotation); tmp_scale = EditorGUILayout.Vector3Field("Scale", tmp_scale); if (GUILayout.Button("Place with transform")) { placeObject(); } GUILayout.Space(10); prefabBrowser.Display(); // TO-DO // Add UI to modify transform settings // Add UI to modify tag and layer settings if (GUILayout.Button("Place")) { placementSettings.active = !placementSettings.active; UpdatePlacementTool(); } if (EditorGUI.EndChangeCheck()) { UpdatePlacementTool(); // Debug.Log("Change detected in variables"); } }
// Method used to display the prefab placement tools. private void DisplayPrefabSpawner() { /* DO YOUR CODING HERE FOR UI */ //Display a dropdown list with all layers, and get the selected one. // AssetObject to attach to parent // Build the necessary UI to display the transform settings EditorGUILayout.Vector3Field("Position", tmp_position); EditorGUILayout.Vector3Field("Rotation", tmp_rotation); EditorGUILayout.Vector3Field("Scale", tmp_scale); prefabBrowser.Display(); // TO-DO // Add UI to modify transform settings // Add UI to modify tag and layer settings if (GUILayout.Button("Place")) { placementSettings.active = !placementSettings.active; UpdatePlacementTool(); } }