| 12345678910111213141516171819202122232425262728293031 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEditor;
- using UnityEditor.SceneManagement;
- namespace FiradzoAssets
- {
- [CustomEditor(typeof(WeaponAttachmentHelper))]
- public class WeaponAttachmentHelperEditor : Editor
- {
- public override void OnInspectorGUI()
- {
- var targetComponent = (target as WeaponAttachmentHelper);
- var canRebind = true;
- if (!EditorSceneManager.IsPreviewScene(targetComponent.gameObject.scene) && PrefabUtility.IsPartOfPrefabInstance(targetComponent.gameObject))
- {
- EditorGUILayout.HelpBox("Component will not work on prefab instance on scene in edit mode. You can unpack prefab or enter prefab edit mode by clicking 'Open' button.", MessageType.Warning);
- canRebind = false;
- }
- GUILayout.Space(10f);
- base.OnInspectorGUI();
- if (canRebind)
- {
- targetComponent.TryRefreshBindedItems();
- }
- }
- }
- }
|