HighlightProfileEditor.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. using UnityEditor;
  2. using UnityEngine;
  3. namespace HighlightPlus {
  4. [CustomEditor(typeof(HighlightProfile))]
  5. [CanEditMultipleObjects]
  6. public class HighlightProfileEditor : Editor {
  7. SerializedProperty effectGroup, effectGroupLayer, effectNameFilter, combineMeshes, alphaCutOff, cullBackFaces;
  8. SerializedProperty overlay, overlayMode, overlayColor, overlayAnimationSpeed, overlayMinIntensity, overlayTexture, overlayTextureScale, overlayTextureUVSpace, overlayBlending, overlayVisibility;
  9. SerializedProperty fadeInDuration, fadeOutDuration, constantWidth, normalsOption;
  10. SerializedProperty outline, outlineColor, outlineColorStyle, outlineGradient, outlineGradientInLocalSpace, outlineWidth, outlineBlurPasses, outlineQuality, outlineEdgeMode, outlineEdgeThreshold, outlineDownsampling, outlineVisibility, outlineIndependent, outlineContourStyle;
  11. SerializedProperty glow, glowWidth, glowQuality, glowBlurMethod, glowDownsampling, glowHQColor, glowDithering, glowMagicNumber1, glowMagicNumber2, glowAnimationSpeed;
  12. SerializedProperty glowBlendPasses, glowVisibility, glowBlendMode, glowPasses, glowIgnoreMask;
  13. SerializedProperty innerGlow, innerGlowWidth, innerGlowColor, innerGlowBlendMode, innerGlowVisibility;
  14. SerializedProperty targetFX, targetFXTexture, targetFXColor, targetFXRotationSpeed, targetFXInitialScale, targetFXEndScale, targetFXScaleToRenderBounds;
  15. SerializedProperty targetFXAlignToGround, targetFXFadePower, targetFXGroundMaxDistance, targetFXGroundLayerMask, targetFXTransitionDuration, targetFXStayDuration, targetFXVisibility;
  16. SerializedProperty seeThrough, seeThroughOccluderMask, seeThroughOccluderMaskAccurate, seeThroughOccluderThreshold, seeThroughOccluderCheckInterval, seeThroughOccluderCheckIndividualObjects, seeThroughDepthOffset, seeThroughMaxDepth;
  17. SerializedProperty seeThroughIntensity, seeThroughTintAlpha, seeThroughTintColor, seeThroughNoise, seeThroughBorder, seeThroughBorderWidth, seeThroughBorderColor, seeThroughOrdered, seeThroughBorderOnly, seeThroughTexture, seeThroughTextureUVSpace, seeThroughTextureScale, seeThroughChildrenSortingMode;
  18. SerializedProperty hitFxInitialIntensity, hitFxMode, hitFxFadeOutDuration, hitFxColor, hitFxRadius;
  19. SerializedProperty cameraDistanceFade, cameraDistanceFadeNear, cameraDistanceFadeFar;
  20. void OnEnable() {
  21. effectGroup = serializedObject.FindProperty("effectGroup");
  22. effectGroupLayer = serializedObject.FindProperty("effectGroupLayer");
  23. effectNameFilter = serializedObject.FindProperty("effectNameFilter");
  24. combineMeshes = serializedObject.FindProperty("combineMeshes");
  25. alphaCutOff = serializedObject.FindProperty("alphaCutOff");
  26. cullBackFaces = serializedObject.FindProperty("cullBackFaces");
  27. normalsOption = serializedObject.FindProperty("normalsOption");
  28. fadeInDuration = serializedObject.FindProperty("fadeInDuration");
  29. fadeOutDuration = serializedObject.FindProperty("fadeOutDuration");
  30. constantWidth = serializedObject.FindProperty("constantWidth");
  31. overlay = serializedObject.FindProperty("overlay");
  32. overlayMode = serializedObject.FindProperty("overlayMode");
  33. overlayColor = serializedObject.FindProperty("overlayColor");
  34. overlayAnimationSpeed = serializedObject.FindProperty("overlayAnimationSpeed");
  35. overlayMinIntensity = serializedObject.FindProperty("overlayMinIntensity");
  36. overlayBlending = serializedObject.FindProperty("overlayBlending");
  37. overlayVisibility = serializedObject.FindProperty("overlayVisibility");
  38. overlayTexture = serializedObject.FindProperty("overlayTexture");
  39. overlayTextureUVSpace = serializedObject.FindProperty("overlayTextureUVSpace");
  40. overlayTextureScale = serializedObject.FindProperty("overlayTextureScale");
  41. outline = serializedObject.FindProperty("outline");
  42. outlineColor = serializedObject.FindProperty("outlineColor");
  43. outlineColorStyle = serializedObject.FindProperty("outlineColorStyle");
  44. outlineGradient = serializedObject.FindProperty("outlineGradient");
  45. outlineGradientInLocalSpace = serializedObject.FindProperty("outlineGradientInLocalSpace");
  46. outlineWidth = serializedObject.FindProperty("outlineWidth");
  47. outlineBlurPasses = serializedObject.FindProperty("outlineBlurPasses");
  48. outlineQuality = serializedObject.FindProperty("outlineQuality");
  49. outlineEdgeMode = serializedObject.FindProperty("outlineEdgeMode");
  50. outlineEdgeThreshold = serializedObject.FindProperty("outlineEdgeThreshold");
  51. outlineDownsampling = serializedObject.FindProperty("outlineDownsampling");
  52. outlineVisibility = serializedObject.FindProperty("outlineVisibility");
  53. outlineIndependent = serializedObject.FindProperty("outlineIndependent");
  54. outlineContourStyle = serializedObject.FindProperty("outlineContourStyle");
  55. glow = serializedObject.FindProperty("glow");
  56. glowWidth = serializedObject.FindProperty("glowWidth");
  57. glowQuality = serializedObject.FindProperty("glowQuality");
  58. glowBlurMethod = serializedObject.FindProperty("glowBlurMethod");
  59. glowDownsampling = serializedObject.FindProperty("glowDownsampling");
  60. glowHQColor = serializedObject.FindProperty("glowHQColor");
  61. glowAnimationSpeed = serializedObject.FindProperty("glowAnimationSpeed");
  62. glowDithering = serializedObject.FindProperty("glowDithering");
  63. glowMagicNumber1 = serializedObject.FindProperty("glowMagicNumber1");
  64. glowMagicNumber2 = serializedObject.FindProperty("glowMagicNumber2");
  65. glowAnimationSpeed = serializedObject.FindProperty("glowAnimationSpeed");
  66. glowBlendPasses = serializedObject.FindProperty("glowBlendPasses");
  67. glowVisibility = serializedObject.FindProperty("glowVisibility");
  68. glowBlendMode = serializedObject.FindProperty("glowBlendMode");
  69. glowPasses = serializedObject.FindProperty("glowPasses");
  70. glowIgnoreMask = serializedObject.FindProperty("glowIgnoreMask");
  71. innerGlow = serializedObject.FindProperty("innerGlow");
  72. innerGlowColor = serializedObject.FindProperty("innerGlowColor");
  73. innerGlowWidth = serializedObject.FindProperty("innerGlowWidth");
  74. innerGlowBlendMode = serializedObject.FindProperty("innerGlowBlendMode");
  75. innerGlowVisibility = serializedObject.FindProperty("innerGlowVisibility");
  76. targetFX = serializedObject.FindProperty("targetFX");
  77. targetFXTexture = serializedObject.FindProperty("targetFXTexture");
  78. targetFXRotationSpeed = serializedObject.FindProperty("targetFXRotationSpeed");
  79. targetFXInitialScale = serializedObject.FindProperty("targetFXInitialScale");
  80. targetFXEndScale = serializedObject.FindProperty("targetFXEndScale");
  81. targetFXScaleToRenderBounds = serializedObject.FindProperty("targetFXScaleToRenderBounds");
  82. targetFXAlignToGround = serializedObject.FindProperty("targetFXAlignToGround");
  83. targetFXGroundMaxDistance = serializedObject.FindProperty("targetFXGroundMaxDistance");
  84. targetFXGroundLayerMask = serializedObject.FindProperty("targetFXGroundLayerMask");
  85. targetFXFadePower = serializedObject.FindProperty("targetFXFadePower");
  86. targetFXColor = serializedObject.FindProperty("targetFXColor");
  87. targetFXTransitionDuration = serializedObject.FindProperty("targetFXTransitionDuration");
  88. targetFXStayDuration = serializedObject.FindProperty("targetFXStayDuration");
  89. targetFXVisibility = serializedObject.FindProperty("targetFXVisibility");
  90. seeThrough = serializedObject.FindProperty("seeThrough");
  91. seeThroughOccluderMask = serializedObject.FindProperty("seeThroughOccluderMask");
  92. seeThroughOccluderMaskAccurate = serializedObject.FindProperty("seeThroughOccluderMaskAccurate");
  93. seeThroughOccluderThreshold = serializedObject.FindProperty("seeThroughOccluderThreshold");
  94. seeThroughOccluderCheckInterval = serializedObject.FindProperty("seeThroughOccluderCheckInterval");
  95. seeThroughOccluderCheckIndividualObjects = serializedObject.FindProperty("seeThroughOccluderCheckIndividualObjects");
  96. seeThroughDepthOffset = serializedObject.FindProperty("seeThroughDepthOffset");
  97. seeThroughMaxDepth = serializedObject.FindProperty("seeThroughMaxDepth");
  98. seeThroughIntensity = serializedObject.FindProperty("seeThroughIntensity");
  99. seeThroughTintAlpha = serializedObject.FindProperty("seeThroughTintAlpha");
  100. seeThroughTintColor = serializedObject.FindProperty("seeThroughTintColor");
  101. seeThroughNoise = serializedObject.FindProperty("seeThroughNoise");
  102. seeThroughBorder = serializedObject.FindProperty("seeThroughBorder");
  103. seeThroughBorderWidth = serializedObject.FindProperty("seeThroughBorderWidth");
  104. seeThroughBorderColor = serializedObject.FindProperty("seeThroughBorderColor");
  105. seeThroughBorderOnly = serializedObject.FindProperty("seeThroughBorderOnly");
  106. seeThroughOrdered = serializedObject.FindProperty("seeThroughOrdered");
  107. seeThroughTexture = serializedObject.FindProperty("seeThroughTexture");
  108. seeThroughTextureScale = serializedObject.FindProperty("seeThroughTextureScale");
  109. seeThroughTextureUVSpace = serializedObject.FindProperty("seeThroughTextureUVSpace");
  110. seeThroughChildrenSortingMode = serializedObject.FindProperty("seeThroughChildrenSortingMode");
  111. hitFxInitialIntensity = serializedObject.FindProperty("hitFxInitialIntensity");
  112. hitFxMode = serializedObject.FindProperty("hitFxMode");
  113. hitFxFadeOutDuration = serializedObject.FindProperty("hitFxFadeOutDuration");
  114. hitFxColor = serializedObject.FindProperty("hitFxColor");
  115. hitFxRadius = serializedObject.FindProperty("hitFxRadius");
  116. cameraDistanceFade = serializedObject.FindProperty("cameraDistanceFade");
  117. cameraDistanceFadeNear = serializedObject.FindProperty("cameraDistanceFadeNear");
  118. cameraDistanceFadeFar = serializedObject.FindProperty("cameraDistanceFadeFar");
  119. }
  120. public override void OnInspectorGUI() {
  121. serializedObject.Update();
  122. EditorGUILayout.Separator();
  123. EditorGUILayout.LabelField("Highlight Options", EditorStyles.boldLabel);
  124. EditorGUILayout.PropertyField(effectGroup, new GUIContent("Include"));
  125. if (effectGroup.intValue == (int)TargetOptions.LayerInScene || effectGroup.intValue == (int)TargetOptions.LayerInChildren) {
  126. EditorGUI.indentLevel++;
  127. EditorGUILayout.PropertyField(effectGroupLayer, new GUIContent("Layer"));
  128. EditorGUI.indentLevel--;
  129. }
  130. if (effectGroup.intValue != (int)TargetOptions.OnlyThisObject && effectGroup.intValue != (int)TargetOptions.Scripting) {
  131. EditorGUI.indentLevel++;
  132. EditorGUILayout.PropertyField(effectNameFilter, new GUIContent("Object Name Filter"));
  133. EditorGUILayout.PropertyField(combineMeshes);
  134. EditorGUI.indentLevel--;
  135. }
  136. EditorGUILayout.PropertyField(alphaCutOff);
  137. EditorGUILayout.PropertyField(cullBackFaces);
  138. EditorGUILayout.PropertyField(normalsOption);
  139. EditorGUILayout.PropertyField(fadeInDuration);
  140. EditorGUILayout.PropertyField(fadeOutDuration);
  141. EditorGUILayout.PropertyField(cameraDistanceFade);
  142. if (cameraDistanceFade.boolValue) {
  143. EditorGUI.indentLevel++;
  144. EditorGUILayout.PropertyField(cameraDistanceFadeNear, new GUIContent("Near Distance"));
  145. EditorGUILayout.PropertyField(cameraDistanceFadeFar, new GUIContent("Far Distance"));
  146. EditorGUI.indentLevel--;
  147. }
  148. EditorGUILayout.PropertyField(constantWidth);
  149. EditorGUILayout.PropertyField(outlineIndependent, new GUIContent("Independent", "Do not combine outline with other highlighted objects."));
  150. EditorGUILayout.Separator();
  151. EditorGUILayout.LabelField("Effects", EditorStyles.boldLabel);
  152. EditorGUILayout.BeginVertical(GUI.skin.box);
  153. DrawSectionField(outline, "Outline", outline.floatValue > 0);
  154. if (outline.floatValue > 0) {
  155. EditorGUI.indentLevel++;
  156. HighlightEffectEditor.QualityPropertyField(outlineQuality);
  157. if (outlineQuality.intValue == (int)QualityLevel.Highest) {
  158. EditorGUILayout.PropertyField(outlineEdgeMode, new GUIContent("Edges"));
  159. if (outlineEdgeMode.intValue == (int)OutlineEdgeMode.Any) {
  160. EditorGUILayout.PropertyField(outlineEdgeThreshold, new GUIContent("Edge Detection Threshold"));
  161. }
  162. EditorGUILayout.PropertyField(outlineContourStyle, new GUIContent("Contour Style"));
  163. EditorGUILayout.PropertyField(outlineWidth, new GUIContent("Width"));
  164. EditorGUILayout.PropertyField(outlineColor, new GUIContent("Color"));
  165. EditorGUILayout.PropertyField(outlineBlurPasses, new GUIContent("Blur Passes"));
  166. } else {
  167. EditorGUILayout.PropertyField(outlineWidth, new GUIContent("Width"));
  168. EditorGUILayout.PropertyField(outlineColorStyle, new GUIContent("Color Style"));
  169. switch ((ColorStyle)outlineColorStyle.intValue) {
  170. case ColorStyle.SingleColor:
  171. EditorGUILayout.PropertyField(outlineColor, new GUIContent("Color"));
  172. break;
  173. case ColorStyle.Gradient:
  174. EditorGUI.indentLevel++;
  175. EditorGUILayout.PropertyField(outlineGradient, new GUIContent("Gradient"));
  176. EditorGUILayout.PropertyField(outlineGradientInLocalSpace, new GUIContent("In Local Space"));
  177. EditorGUI.indentLevel--;
  178. break;
  179. }
  180. }
  181. if (outlineQuality.intValue == (int)QualityLevel.Highest && outlineEdgeMode.intValue != (int)OutlineEdgeMode.Any) {
  182. EditorGUILayout.PropertyField(outlineDownsampling, new GUIContent("Downsampling"));
  183. }
  184. if (outlineQuality.intValue == (int)QualityLevel.Highest && glowQuality.intValue == (int)QualityLevel.Highest) {
  185. EditorGUILayout.PropertyField(glowVisibility, new GUIContent("Visibility"));
  186. } else {
  187. EditorGUILayout.PropertyField(outlineVisibility, new GUIContent("Visibility"));
  188. }
  189. EditorGUI.indentLevel--;
  190. }
  191. EditorGUILayout.EndVertical();
  192. EditorGUILayout.BeginVertical(GUI.skin.box);
  193. DrawSectionField(glow, "Outer Glow", glow.floatValue > 0);
  194. if (glow.floatValue > 0) {
  195. EditorGUI.indentLevel++;
  196. HighlightEffectEditor.QualityPropertyField(glowQuality);
  197. if (glowQuality.intValue == (int)QualityLevel.Highest) {
  198. EditorGUILayout.PropertyField(outlineContourStyle, new GUIContent("Contour Style"));
  199. EditorGUILayout.PropertyField(glowWidth, new GUIContent("Width"));
  200. EditorGUILayout.PropertyField(glowHQColor, new GUIContent("Color"));
  201. EditorGUILayout.PropertyField(glowBlurMethod, new GUIContent("Blur Method", "Gaussian: better quality. Kawase: faster."));
  202. EditorGUILayout.PropertyField(glowDownsampling, new GUIContent("Downsampling"));
  203. } else {
  204. EditorGUILayout.PropertyField(glowWidth, new GUIContent("Width"));
  205. }
  206. EditorGUILayout.PropertyField(glowAnimationSpeed, new GUIContent("Animation Speed"));
  207. EditorGUILayout.PropertyField(glowVisibility, new GUIContent("Visibility"));
  208. EditorGUILayout.PropertyField(glowBlendMode, new GUIContent("Blend Mode"));
  209. if (glowQuality.intValue != (int)QualityLevel.Highest) {
  210. EditorGUILayout.PropertyField(glowDithering, new GUIContent("Dithering"));
  211. if (glowDithering.boolValue) {
  212. EditorGUI.indentLevel++;
  213. EditorGUILayout.PropertyField(glowMagicNumber1, new GUIContent("Magic Number 1"));
  214. EditorGUILayout.PropertyField(glowMagicNumber2, new GUIContent("Magic Number 2"));
  215. EditorGUI.indentLevel--;
  216. }
  217. EditorGUILayout.PropertyField(glowBlendPasses, new GUIContent("Blend Passes"));
  218. EditorGUILayout.PropertyField(glowPasses, true);
  219. EditorGUILayout.PropertyField(glowIgnoreMask, new GUIContent("Ignore Mask"));
  220. }
  221. EditorGUI.indentLevel--;
  222. }
  223. EditorGUILayout.EndVertical();
  224. EditorGUILayout.BeginVertical(GUI.skin.box);
  225. DrawSectionField(innerGlow, "Inner Glow", innerGlow.floatValue > 0);
  226. if (innerGlow.floatValue > 0) {
  227. EditorGUI.indentLevel++;
  228. EditorGUILayout.PropertyField(innerGlowColor, new GUIContent("Color"));
  229. EditorGUILayout.PropertyField(innerGlowWidth, new GUIContent("Width"));
  230. EditorGUILayout.PropertyField(innerGlowBlendMode, new GUIContent("Blend Mode"));
  231. EditorGUILayout.PropertyField(innerGlowVisibility, new GUIContent("Visibility"));
  232. EditorGUI.indentLevel--;
  233. }
  234. EditorGUILayout.EndVertical();
  235. EditorGUILayout.BeginVertical(GUI.skin.box);
  236. DrawSectionField(overlay, "Overlay", overlay.floatValue > 0);
  237. if (overlay.floatValue > 0) {
  238. EditorGUI.indentLevel++;
  239. EditorGUILayout.PropertyField(overlayMode, new GUIContent("Mode"));
  240. EditorGUILayout.PropertyField(overlayColor, new GUIContent("Color"));
  241. EditorGUILayout.PropertyField(overlayTexture, new GUIContent("Texture"));
  242. if (overlayTexture.objectReferenceValue != null) {
  243. EditorGUI.indentLevel++;
  244. EditorGUILayout.PropertyField(overlayTextureUVSpace, new GUIContent("UV Space"));
  245. EditorGUILayout.PropertyField(overlayTextureScale, new GUIContent("Texture Scale"));
  246. EditorGUI.indentLevel--;
  247. }
  248. EditorGUILayout.PropertyField(overlayBlending, new GUIContent("Blending"));
  249. EditorGUILayout.PropertyField(overlayMinIntensity, new GUIContent("Min Intensity"));
  250. EditorGUILayout.PropertyField(overlayAnimationSpeed, new GUIContent("Animation Speed"));
  251. EditorGUILayout.PropertyField(overlayVisibility, new GUIContent("Visibility"));
  252. EditorGUI.indentLevel--;
  253. }
  254. EditorGUILayout.EndVertical();
  255. EditorGUILayout.BeginVertical(GUI.skin.box);
  256. DrawSectionField(targetFX, "Target", targetFX.boolValue);
  257. if (targetFX.boolValue) {
  258. EditorGUI.indentLevel++;
  259. EditorGUILayout.PropertyField(targetFXTexture, new GUIContent("Texture"));
  260. EditorGUILayout.PropertyField(targetFXColor, new GUIContent("Color"));
  261. EditorGUILayout.PropertyField(targetFXRotationSpeed, new GUIContent("Rotation Speed"));
  262. EditorGUILayout.PropertyField(targetFXInitialScale, new GUIContent("Initial Scale"));
  263. EditorGUILayout.PropertyField(targetFXEndScale, new GUIContent("End Scale"));
  264. EditorGUILayout.PropertyField(targetFXScaleToRenderBounds, new GUIContent("Scale To Object Bounds"));
  265. EditorGUILayout.PropertyField(targetFXAlignToGround, new GUIContent("Align To Ground"));
  266. if (targetFXAlignToGround.boolValue) {
  267. EditorGUI.indentLevel++;
  268. EditorGUILayout.PropertyField(targetFXGroundMaxDistance, new GUIContent("Ground Max Distance"));
  269. EditorGUILayout.PropertyField(targetFXGroundLayerMask, new GUIContent("Ground Layer Mask"));
  270. EditorGUILayout.PropertyField(targetFXFadePower, new GUIContent("Fade Power"));
  271. EditorGUI.indentLevel--;
  272. }
  273. EditorGUILayout.PropertyField(targetFXTransitionDuration, new GUIContent("Transition Duration"));
  274. EditorGUILayout.PropertyField(targetFXStayDuration, new GUIContent("Stay Duration"));
  275. EditorGUILayout.PropertyField(targetFXVisibility, new GUIContent("Visibility"));
  276. EditorGUI.indentLevel--;
  277. }
  278. EditorGUILayout.EndVertical();
  279. EditorGUILayout.BeginVertical(GUI.skin.box);
  280. EditorGUILayout.PropertyField(seeThrough);
  281. if (seeThrough.intValue != (int)SeeThroughMode.Never) {
  282. EditorGUI.indentLevel++;
  283. EditorGUILayout.PropertyField(seeThroughOccluderMask, new GUIContent("Occluder Layer"));
  284. if (seeThroughOccluderMask.intValue > 0) {
  285. EditorGUI.indentLevel++;
  286. EditorGUILayout.PropertyField(seeThroughOccluderMaskAccurate, new GUIContent("Accurate"));
  287. EditorGUILayout.PropertyField(seeThroughOccluderThreshold, new GUIContent("Radius Threshold", "Multiplier to the object bounds. Making the bounds smaller prevents false occlusion tests."));
  288. EditorGUILayout.PropertyField(seeThroughOccluderCheckInterval, new GUIContent("Check Interval", "Interval in seconds between occlusion tests."));
  289. EditorGUILayout.PropertyField(seeThroughOccluderCheckIndividualObjects, new GUIContent("Check Individual Objects", "Interval in seconds between occlusion tests."));
  290. EditorGUI.indentLevel--;
  291. }
  292. EditorGUILayout.PropertyField(seeThroughDepthOffset, new GUIContent("Depth Offset" + ((seeThroughDepthOffset.floatValue > 0) ? " •" : "")));
  293. EditorGUILayout.PropertyField(seeThroughMaxDepth, new GUIContent("Max Depth" + ((seeThroughMaxDepth.floatValue > 0) ? " •" : "")));
  294. EditorGUILayout.PropertyField(seeThroughIntensity, new GUIContent("Intensity"));
  295. EditorGUILayout.PropertyField(seeThroughTintColor, new GUIContent("Color"));
  296. EditorGUILayout.PropertyField(seeThroughTintAlpha, new GUIContent("Color Blend"));
  297. EditorGUILayout.PropertyField(seeThroughNoise, new GUIContent("Noise"));
  298. EditorGUILayout.PropertyField(seeThroughTexture, new GUIContent("Texture"));
  299. if (seeThroughTexture.objectReferenceValue != null) {
  300. EditorGUILayout.PropertyField(seeThroughTextureUVSpace, new GUIContent("UV Space"));
  301. EditorGUILayout.PropertyField(seeThroughTextureScale, new GUIContent("Texture Scale"));
  302. }
  303. EditorGUILayout.PropertyField(seeThroughBorder, new GUIContent("Border When Hidden"));
  304. if (seeThroughBorder.floatValue > 0) {
  305. EditorGUI.indentLevel++;
  306. EditorGUILayout.PropertyField(seeThroughBorderWidth, new GUIContent("Width"));
  307. EditorGUILayout.PropertyField(seeThroughBorderColor, new GUIContent("Color"));
  308. EditorGUILayout.PropertyField(seeThroughBorderOnly, new GUIContent("Border Only"));
  309. EditorGUI.indentLevel--;
  310. }
  311. EditorGUILayout.PropertyField(seeThroughChildrenSortingMode, new GUIContent("Children Sorting Mode"));
  312. EditorGUILayout.PropertyField(seeThroughOrdered, new GUIContent("Ordered"));
  313. EditorGUI.indentLevel--;
  314. }
  315. EditorGUILayout.EndVertical();
  316. EditorGUILayout.BeginVertical(GUI.skin.box);
  317. DrawSectionField(hitFxInitialIntensity, "Hit FX", hitFxInitialIntensity.floatValue > 0);
  318. if (hitFxInitialIntensity.floatValue > 0) {
  319. EditorGUI.indentLevel++;
  320. EditorGUILayout.PropertyField(hitFxInitialIntensity, new GUIContent("Initial Intensity"));
  321. EditorGUILayout.PropertyField(hitFxMode, new GUIContent("Mode"));
  322. EditorGUILayout.PropertyField(hitFxFadeOutDuration, new GUIContent("Fade Out Duration"));
  323. EditorGUILayout.PropertyField(hitFxColor, new GUIContent("Color"));
  324. if ((HitFxMode)hitFxMode.intValue == HitFxMode.LocalHit) {
  325. EditorGUILayout.PropertyField(hitFxRadius, new GUIContent("Radius"));
  326. }
  327. EditorGUI.indentLevel--;
  328. }
  329. EditorGUILayout.EndVertical();
  330. if (serializedObject.ApplyModifiedProperties() || (Event.current.type == EventType.ValidateCommand &&
  331. Event.current.commandName == "UndoRedoPerformed")) {
  332. // Triggers profile reload on all Highlight Effect scripts
  333. HighlightEffect[] effects = FindObjectsOfType<HighlightEffect>();
  334. for (int t = 0; t < targets.Length; t++) {
  335. HighlightProfile profile = (HighlightProfile)targets[t];
  336. for (int k = 0; k < effects.Length; k++) {
  337. if (effects[k] != null && effects[k].profile == profile && effects[k].profileSync) {
  338. profile.Load(effects[k]);
  339. effects[k].Refresh();
  340. }
  341. }
  342. }
  343. EditorUtility.SetDirty(target);
  344. }
  345. }
  346. void DrawSectionField(SerializedProperty property, string label, bool active) {
  347. EditorGUILayout.PropertyField(property, new GUIContent(active ? label + " •" : label));
  348. }
  349. }
  350. }