// Draw the property inside the given rect
    public override void OnGUI( Rect position, SerializedProperty property, GUIContent label )
    {
        // Now draw the property as a Slider or an IntSlider based on whether it’s a float or integer.
        if ( property.type != "MinMaxRange" )
            Debug.LogWarning( "Use only with MinMaxRange type" );
        else
        {
            var range = attribute as MinMaxRangeAttribute;
            var minValue = property.FindPropertyRelative( "rangeStart" );
            var maxValue = property.FindPropertyRelative( "rangeEnd" );
            var newMin = minValue.floatValue;
            var newMax = maxValue.floatValue;

            var xDivision = position.width * 0.33f;
            var yDivision = position.height * 0.5f;
            EditorGUI.LabelField( new Rect( position.x, position.y, xDivision, yDivision ), label );

            EditorGUI.LabelField( new Rect( position.x, position.y + yDivision, position.width, yDivision ), range.minLimit.ToString( "0.##" ) );
            EditorGUI.LabelField( new Rect( position.x + position.width - 28f, position.y + yDivision, position.width, yDivision ), range.maxLimit.ToString( "0.##" ) );
            EditorGUI.MinMaxSlider( new Rect( position.x + 24f, position.y + yDivision, position.width - 48f, yDivision ), ref newMin, ref newMax, range.minLimit, range.maxLimit );

            EditorGUI.LabelField( new Rect( position.x + xDivision, position.y, xDivision, yDivision ), "From: " );
            newMin = Mathf.Clamp( EditorGUI.FloatField( new Rect( position.x + xDivision + 30, position.y, xDivision - 30, yDivision ), newMin ), range.minLimit, newMax );
            EditorGUI.LabelField( new Rect( position.x + xDivision * 2f, position.y, xDivision, yDivision ), "To: " );
            newMax = Mathf.Clamp( EditorGUI.FloatField( new Rect( position.x + xDivision * 2f + 24, position.y, xDivision - 24, yDivision ), newMax ), newMin, range.maxLimit );

            minValue.floatValue = newMin;
            maxValue.floatValue = newMax;
        }
    }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            rtpc = property.GetValue<AudioRTPC>();

            Begin(position, property, label);

            string rtpcName = string.Format("{4}{0} | {1} [{2}, {3}]", rtpc.Name, rtpc.Type, rtpc.MinValue, rtpc.MaxValue, rtpc.Scope == AudioRTPC.RTPCScope.Global ? "*" : "");
            PropertyField(property, rtpcName.ToGUIContent(), false);

            if (property.isExpanded)
            {
                EditorGUI.indentLevel++;

                PropertyField(property.FindPropertyRelative("Scope"), GUIContent.none);
                PropertyField(property.FindPropertyRelative("Name"));
                PropertyField(property.FindPropertyRelative("Type"));
                PropertyField(property.FindPropertyRelative("MinValue"));
                PropertyField(property.FindPropertyRelative("MaxValue"));
                PropertyField(property.FindPropertyRelative("Curve"));

                EditorGUI.indentLevel--;
            }

            End();
        }
	void OnEnable()
	{
		p_aoMode = serializedObject.FindProperty("Mode");
		p_noiseTexture = serializedObject.FindProperty("NoiseTexture");
		//p_maskTexture = serializedObject.FindProperty("MaskTexture");

#if UNITY_4_X
		p_useHighPrecisionDepthMap = serializedObject.FindProperty("UseHighPrecisionDepthMap");
#endif

		p_samples = serializedObject.FindProperty("Samples");
		p_downsampling = serializedObject.FindProperty("Downsampling");
		p_radius = serializedObject.FindProperty("Radius");
		p_intensity = serializedObject.FindProperty("Intensity");
		p_distance = serializedObject.FindProperty("Distance");
		p_bias = serializedObject.FindProperty("Bias");
		p_tag = serializedObject.FindProperty("Tag");
		p_lumContribution = serializedObject.FindProperty("LumContribution");
		p_occlusionColor = serializedObject.FindProperty("OcclusionColor");
		p_cutoffDistance = serializedObject.FindProperty("CutoffDistance");
		p_cutoffFalloff = serializedObject.FindProperty("CutoffFalloff");
		p_blur = serializedObject.FindProperty("Blur");
		p_blurDownsampling = serializedObject.FindProperty("BlurDownsampling");
		p_blurPasses = serializedObject.FindProperty("BlurPasses");
		p_blurBilateralThreshold = serializedObject.FindProperty("BlurBilateralThreshold");
		p_debugAO = serializedObject.FindProperty("DebugAO");
	}
Example #4
0
        void OnEnable () {
            serObj = new SerializedObject (target);

            screenBlendMode = serObj.FindProperty("screenBlendMode");
            hdr = serObj.FindProperty("hdr");

            sepBlurSpread = serObj.FindProperty("sepBlurSpread");
            useSrcAlphaAsMask = serObj.FindProperty("useSrcAlphaAsMask");

            bloomIntensity = serObj.FindProperty("bloomIntensity");
            bloomthreshold = serObj.FindProperty("bloomThreshold");
            bloomBlurIterations = serObj.FindProperty("bloomBlurIterations");

            lensflares = serObj.FindProperty("lensflares");

            lensflareMode = serObj.FindProperty("lensflareMode");
            hollywoodFlareBlurIterations = serObj.FindProperty("hollywoodFlareBlurIterations");
            hollyStretchWidth = serObj.FindProperty("hollyStretchWidth");
            lensflareIntensity = serObj.FindProperty("lensflareIntensity");
            lensflarethreshold = serObj.FindProperty("lensflareThreshold");
            flareColorA = serObj.FindProperty("flareColorA");
            flareColorB = serObj.FindProperty("flareColorB");
            flareColorC = serObj.FindProperty("flareColorC");
            flareColorD = serObj.FindProperty("flareColorD");
            lensFlareVignetteMask = serObj.FindProperty("lensFlareVignetteMask");

            tweakMode = serObj.FindProperty("tweakMode");
        }
 public void OnEnable()
 {
   this.m_UseColliderMask = this.serializedObject.FindProperty("m_UseColliderMask");
   this.m_ColliderMask = this.serializedObject.FindProperty("m_ColliderMask");
   this.m_ShowColliderMask.value = (this.target as Effector2D).useColliderMask;
   this.m_ShowColliderMask.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint));
 }
	public static void construct(SerializedProperty prop){
		prop.FindPropertyRelative("name").stringValue = "Animation Set Name";         
		SerializedProperty animations = prop.FindPropertyRelative ("animations");
		animations.arraySize = 1;
		AnimationDrawer.construct (animations.GetArrayElementAtIndex(0));
		prop.serializedObject.ApplyModifiedProperties();
	}
	void OnEnable(){
		point = (BezierPoint)target;
		
		handleTypeProp = serializedObject.FindProperty("handleStyle");
		handle1Prop = serializedObject.FindProperty("_handle1");
		handle2Prop = serializedObject.FindProperty("_handle2");
	}	
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            float height = base.GetPropertyHeight(property, label);
            CheckRequiredComponents(property.GetValue<EntityBehaviour>());

            return height;
        }
		/// <summary>
		/// 	Override this method to make your own GUI for the property
		/// </summary>
		/// <param name="position">Position</param>
		/// <param name="prop">Property</param>
		/// <param name="label">Label</param>
		public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
		{
			label = EditorGUI.BeginProperty(position, label, prop);

			position.height = EditorGUIUtility.singleLineHeight;
			Rect contents = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

			FindProperties(prop);

			// Draw the preview texture
			Rect textureRect = new Rect(contents);
			textureRect.x += textureRect.width - PREVIEW_TEXTURE_SIZE;
			textureRect.width = PREVIEW_TEXTURE_SIZE;
			textureRect.height = PREVIEW_TEXTURE_SIZE;

			EditorGUI.BeginChangeCheck();

			HydraEditorUtils.DrawUnindented(
										    () => HydraEditorUtils.TextureField(textureRect, GUIContent.none, m_TextureProp, true));

			// Draw the fields
			Rect contentRect = new Rect(contents);
			contentRect.width -= textureRect.width + HydraEditorUtils.STANDARD_HORIZONTAL_SPACING * 2.0f;
			HydraEditorUtils.DrawUnindented(
										    () =>
											HydraEditorUtils.EnumPopupField<Texture2DAttribute.Wrap>(contentRect, GUIContent.none, m_WrapProp,
																									 HydraEditorGUIStyles.enumStyle));

			// Clear the cache if the texture changes
			if (EditorGUI.EndChangeCheck())
				m_WrappedTextureProp.objectReferenceValue = null;

			EditorGUI.EndProperty();
		}
Example #10
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);

        MinMax minMax = attribute as MinMax;

        if (property.propertyType != SerializedPropertyType.Vector2) {
            EditorGUI.PropertyField(position, property);
            Debug.LogWarning("The MinMax property can only be used on Vector2!");
            return;
        }

        Vector2 value = property.vector2Value;

        position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

        float w = position.width * PERCENT_NUM;

        Rect leftNum = new Rect(position.x, position.y, w, position.height);
        Rect slider = new Rect(position.x + w + SPACING, position.y, position.width - 2 * w - SPACING * 2, position.height);
        Rect rightNum = new Rect(position.x + position.width - w, position.y, w, position.height);

        float newMin = EditorGUI.FloatField(leftNum, value.x);
        float newMax = EditorGUI.FloatField(rightNum, value.y);

        value.x = Mathf.Clamp(newMin, minMax.min, value.y);
        value.y = Mathf.Clamp(newMax, value.x, minMax.max);

        EditorGUI.MinMaxSlider(slider, ref value.x, ref value.y, minMax.min, minMax.max);

        property.vector2Value = value;

        EditorGUI.EndProperty();
    }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
        WritableAttribute attr = attribute as WritableAttribute;
        GUI.enabled = attr.Result(DrawerUtil.GetTarget(property));
        DrawerUtil.OnGUI(position, property, label);
        GUI.enabled = true;

    }
        void OnEnable()
        {
            serObj = new SerializedObject (target);

            visualizeFocus = serObj.FindProperty ("visualizeFocus");

            focalLength = serObj.FindProperty ("focalLength");
            focalSize = serObj.FindProperty ("focalSize");
            aperture = serObj.FindProperty ("aperture");
            focalTransform = serObj.FindProperty ("focalTransform");
            maxBlurSize = serObj.FindProperty ("maxBlurSize");
            highResolution = serObj.FindProperty ("highResolution");

            blurType = serObj.FindProperty ("blurType");
            blurSampleCount = serObj.FindProperty ("blurSampleCount");

            nearBlur = serObj.FindProperty ("nearBlur");
            foregroundOverlap = serObj.FindProperty ("foregroundOverlap");

            dx11BokehThreshold = serObj.FindProperty ("dx11BokehThreshold");
            dx11SpawnHeuristic = serObj.FindProperty ("dx11SpawnHeuristic");
            dx11BokehTexture = serObj.FindProperty ("dx11BokehTexture");
            dx11BokehScale = serObj.FindProperty ("dx11BokehScale");
            dx11BokehIntensity = serObj.FindProperty ("dx11BokehIntensity");
        }
		void OnEnable()
		{
			p_RedRefraction = serializedObject.FindProperty("RedRefraction");
			p_GreenRefraction = serializedObject.FindProperty("GreenRefraction");
			p_BlueRefraction = serializedObject.FindProperty("BlueRefraction");
			p_PreserveAlpha = serializedObject.FindProperty("PreserveAlpha");
		}
    /// <summary>
    /// Show the RequiredField inspector. Changes depending on the field being
    /// empty or not.
    /// </summary>
    public override void OnGUI(Rect a_position, SerializedProperty a_property, GUIContent a_label)
    {
        // Split the widget position rectangle horizontally.
        Rect bottom = new Rect();
        Rect top = new Rect();
        SplitRect(a_position, ref top, ref bottom);

        // Save the default GUI color for later.
        Color defaultColor = GUI.color;

        // If the object pointed by the property is null, then show the error
        // message, and set the GUI color to red to display the PropertyField in
        // red.
        if(a_property.objectReferenceValue == null) {
            EditorGUI.HelpBox(top, "The field below is required and can't be empty.", MessageType.Error);
            GUI.color = Color.red;
        }

        // Draw the default property field, this drawer does not alter the GUI.
        if(a_property.objectReferenceValue == null) {
            EditorGUI.PropertyField(bottom, a_property, a_label);
        }
        else {
            EditorGUI.PropertyField(a_position, a_property, a_label);
        }

        // Restore the original colors.
        GUI.color = defaultColor;
    }
	void OnEnable()
	{
		exposure = serializedObject.FindProperty( "Exposure" );
		useToneMapping = serializedObject.FindProperty( "UseToneMapping" );
		useDithering = serializedObject.FindProperty( "UseDithering" );

		qualityLevel = serializedObject.FindProperty( "QualityLevel" );
		blendAmount = serializedObject.FindProperty( "BlendAmount" );
		lutTexture = serializedObject.FindProperty( "LutTexture" );
		lutBlendTexture = serializedObject.FindProperty( "LutBlendTexture" );
		maskTexture = serializedObject.FindProperty( "MaskTexture" );
		useDepthMask = serializedObject.FindProperty( "UseDepthMask" );
		depthMaskCurve = serializedObject.FindProperty( "DepthMaskCurve" );

		useVolumes = serializedObject.FindProperty( "UseVolumes" );
		exitVolumeBlendTime = serializedObject.FindProperty( "ExitVolumeBlendTime" );
		triggerVolumeProxy = serializedObject.FindProperty( "TriggerVolumeProxy" );
		volumeCollisionMask = serializedObject.FindProperty( "VolumeCollisionMask" );

		if ( !Application.isPlaying )
		{
			AmplifyColorBase effect = target as AmplifyColorBase;

			bool needsNewID = string.IsNullOrEmpty( effect.SharedInstanceID );
			if ( !needsNewID )
				needsNewID = FindClone( effect );

			if ( needsNewID )
			{
				effect.NewSharedInstanceID();
				EditorUtility.SetDirty( target );
			}
		}
	}
 internal float GetPropertyHeightSafe(SerializedProperty property, GUIContent label)
 {
     ScriptAttributeUtility.s_DrawerStack.Push(this);
     float propertyHeight = this.GetPropertyHeight(property, label);
     ScriptAttributeUtility.s_DrawerStack.Pop();
     return propertyHeight;
 }
	void OnEnable()
	{
		script = serializedObject.FindProperty("m_Script");
		index = serializedObject.FindProperty("index");
		modelOverride = serializedObject.FindProperty("modelOverride");
		verbose = serializedObject.FindProperty("verbose");
		createComponents = serializedObject.FindProperty("createComponents");
		updateDynamically = serializedObject.FindProperty("updateDynamically");

		// Load render model names if necessary.
		if (renderModelNames == null)
		{
			renderModelNames = LoadRenderModelNames();
		}

		// Update renderModelIndex based on current modelOverride value.
		if (modelOverride.stringValue != "")
		{
			for (int i = 0; i < renderModelNames.Length; i++)
			{
				if (modelOverride.stringValue == renderModelNames[i])
				{
					renderModelIndex = i;
					break;
				}
			}
		}
	}
Example #18
0
	void OnEnable() {
		PrebufferLengthAsMultipleOfDSPBufferProp = serializedObject.FindProperty("PrebufferLengthAsMultipleOfDSPBuffer");
		ProcessingPeriodAsMultipleOfDSPBufferProp = serializedObject.FindProperty("ProcessingPeriodAsMultipleOfDSPBuffer");
		startUrgencyProp = serializedObject.FindProperty("startUrgency");
		themeFolderProp = serializedObject.FindProperty("themeFolder");
		startingActionPresetProp = serializedObject.FindProperty ("startActionPreset");
		startRendevousProp = serializedObject.FindProperty ("startRendevous");
		startMinLevelProp = serializedObject.FindProperty ("startMinLevel");
		startMaxLevelProp = serializedObject.FindProperty ("startMaxLevel");
		startStingerProp = serializedObject.FindProperty ("startStinger");
		startKeyProp = serializedObject.FindProperty ("startKey");
		useActionPresetOnStartProp = serializedObject.FindProperty ("useActionPresetOnStart");
		startThemeOnStartProp = serializedObject.FindProperty ("startThemeOnStart");
		loadTypeProp = serializedObject.FindProperty ("loadType");
		showPendingTriggerChangeInfoProp = serializedObject.FindProperty ("showPendingTriggerChangeInfo");
		
		string basePath = Path.Combine(Application.streamingAssetsPath, "ELIAS_Themes");
		popup_options = FindSubDirectories(basePath);
		
		// Each time this editor is enabled (i.e turns up in the inspector), find
		// the currently chosen element.
		popup_index = FindStringIndex(themeFolderProp.stringValue, popup_options);

		prebufferOptionsIndex = ArrayUtility.IndexOf<int> (prebufferOptionsValues, PrebufferLengthAsMultipleOfDSPBufferProp.intValue);
	}
		void OnEnable()
		{
			p_Quality = serializedObject.FindProperty("Quality");
			p_Samples = serializedObject.FindProperty("Samples");
			p_Strength = serializedObject.FindProperty("Strength");
			p_Angle = serializedObject.FindProperty("Angle");
		}
Example #20
0
    public static void Show(SerializedProperty list,
	                        EditorListOption options = EditorListOption.Default)
    {
        if (!list.isArray) {
            EditorGUILayout.HelpBox(list.name + " is neither an array nor a list!", MessageType.Error);
            return;
        }
        bool showListLabel = (options & EditorListOption.ListLabel) != 0;
        bool showListSize  = (options & EditorListOption.ListSize)  != 0;
        if (showListLabel) {
            EditorGUILayout.PropertyField(list);
            EditorGUI.indentLevel += 1;
        }
        if (!showListLabel || list.isExpanded) {
            SerializedProperty size = list.FindPropertyRelative("Array.size");
            if (showListSize) {
                EditorGUILayout.PropertyField(list.FindPropertyRelative("Array.size"));
            }
            if (size.hasMultipleDifferentValues) {
                EditorGUILayout.HelpBox("Not showing lists with different sizes.", MessageType.Info);
            } else {
                ShowElements(list, options);
            }
        }
        if (showListLabel) {
            EditorGUI.indentLevel -= 1;
        }
    }
    void OnEnable()
    {
		displayManager = target as RUISDisplayManager;
		
        displays = serializedObject.FindProperty("displays");
		ruisMenuPrefab = serializedObject.FindProperty("ruisMenuPrefab");
		
		guiX = serializedObject.FindProperty("guiX");
		guiY = serializedObject.FindProperty("guiY");
		guiZ = serializedObject.FindProperty("guiZ");
		guiScaleX = serializedObject.FindProperty("guiScaleX");
		guiScaleY = serializedObject.FindProperty("guiScaleY");
		hideMouseOnPlay = serializedObject.FindProperty("hideMouseOnPlay");
		
		displayManagerLink = new SerializedObject(displayManager);
		guiDisplayChoiceLink = displayManagerLink.FindProperty("guiDisplayChoice");
		
//        allowResolutionDialog = serializedObject.FindProperty("allowResolutionDialog");
        displayPrefab = Resources.Load("RUIS/Prefabs/Main RUIS/RUISDisplay") as GameObject;

        displayBoxStyle = new GUIStyle();
        displayBoxStyle.normal.textColor = Color.white;
        displayBoxStyle.alignment = TextAnchor.MiddleCenter;
        displayBoxStyle.border = new RectOffset(2, 2, 2, 2);
        displayBoxStyle.margin = new RectOffset(1, 0, 0, 0);
        displayBoxStyle.wordWrap = true;

        monoDisplayTexture = Resources.Load("RUIS/Editor/Textures/monodisplay") as Texture2D;
        stereoDisplayTexture = Resources.Load("RUIS/Editor/Textures/stereodisplay") as Texture2D;
		
		menuCursorPrefab = serializedObject.FindProperty("menuCursorPrefab");
		menuLayer = serializedObject.FindProperty("menuLayer");
    }
        public override float GetPropertyHeight(SerializedProperty _property, GUIContent _label)
        {
            if (_property.isArray)
                return EditorGUI.GetPropertyHeight(_property);

            return EditorGUI.GetPropertyHeight(_property) + kButtonHeight + kOffset;
        }
	void CurveGui ( string name ,   SerializedProperty animationCurve ,   Color color  ){
		// @NOTE: EditorGUILayout.CurveField is buggy and flickers, using PropertyField for now
        //animationCurve.animationCurveValue = EditorGUILayout.CurveField (GUIContent (name), animationCurve.animationCurveValue, color, Rect (0.0f,0.0f,1.0f,1.0f));
		EditorGUILayout.PropertyField (animationCurve, new GUIContent (name));
		if (GUI.changed) 
			applyCurveChanges = true;
	}
Example #24
0
		public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label) {
			string valueStr;
			switch (_property.propertyType) {
				case SerializedPropertyType.Integer:
					valueStr = _property.intValue.ToString();
					break;
				case SerializedPropertyType.Boolean:
					valueStr = _property.boolValue.ToString();
					break;
				case SerializedPropertyType.Float:
					valueStr = _property.floatValue.ToString("0.00000");
					break;
				case SerializedPropertyType.String:
					valueStr = _property.stringValue;
					break;
				case SerializedPropertyType.Enum:
					valueStr = _property.enumDisplayNames[_property.enumValueIndex];
					break;
				case SerializedPropertyType.Vector2:
					valueStr = _property.vector2Value.ToString();
					break;
				case SerializedPropertyType.Vector3:
					valueStr = _property.vector3Value.ToString();
					break;
				default:
					valueStr = "(not supported)";
					break;
			}

			EditorGUI.LabelField(_position, _label.text + ":", valueStr);
		}
    void Initialize(SerializedProperty property)
    {
        if (listedScenes != null && listedScenes.Length > 0)
            return;

        var scenes = EditorBuildSettings.scenes;
        var selectableScenes = new System.Collections.Generic.List<EditorBuildSettingsScene>();

        SceneSelectionAttribute attr = (SceneSelectionAttribute)attribute;

        for (int i = 0; i < scenes.Length; i++)
        {
            if (scenes[i].enabled || attr.allowDisabledScenes)
                selectableScenes.Add(scenes[i]);
        }
        listedScenes = new GUIContent[selectableScenes.Count];

        for (int i = 0; i < listedScenes.Length; i++)
        {
            var path = selectableScenes[i].path;
            int lastSeparator = path.LastIndexOf("/") + 1;
            var sceneName = path.Substring(lastSeparator, path.LastIndexOf(".") - lastSeparator);
            listedScenes[i] = new GUIContent(sceneName, selectableScenes[i].enabled ? "Enabled" : "Disabled");
            if (listedScenes[i].text.Equals(property.stringValue))
                selectedIndex = i;
        }
    }
 private void OnEnable()
 {
     _sendCreationMessageProp = serializedObject.FindProperty("sendCreationMessage");
     _useCapProp = serializedObject.FindProperty("useCap");
     _capAmountProp = serializedObject.FindProperty("capAmount");
     _reuseMessagingProp = serializedObject.FindProperty("reuseMessaging");
 }
		public override void OnGUI (Rect pos, SerializedProperty prop, GUIContent label) {


			SerializedProperty selection = prop.FindPropertyRelative("selection");
			SerializedProperty gameObject = prop.FindPropertyRelative("gameObject");

			CacheOwnerGameObject(prop.serializedObject);


			// draw the enum popup Field
			int oldEnumIndex = selection.enumValueIndex;

			EditorGUI.PropertyField(
				GetRectforRow(pos,0),
				selection,new GUIContent("Target"),true);

			if (oldEnumIndex !=selection.enumValueIndex)
			{
				if (selection.enumValueIndex==1)
				{
					gameObject.objectReferenceValue = ownerGameObject;
				}
			}

			if (selection.enumValueIndex==1)
			{
				EditorGUI.indentLevel++;

				EditorGUI.PropertyField(
					GetRectforRow(pos,1),
					gameObject,new GUIContent("Game Object"),true);
			}
	
		}
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);
            {
                if (EditorGUI.PropertyField(position, property))
                {
                    EditorGUILayout.PropertyField(property.FindPropertyRelative("type"));

                    switch (property.FindPropertyRelative("type").enumValueIndex)
                    {
                        case 0: // None
                            break;
                        case 1: // Sphere
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("center"));
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("radius"));
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("physicsMaterial"));
                            break;
                        case 2: // Box
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("center"));
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("size"));
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("physicsMaterial"));
                            break;
                        case 3: // Capsule
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("center"));
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("direction"));
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("radius"));
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("height"));
                            EditorGUILayout.PropertyField(property.FindPropertyRelative("physicsMaterial"));
                            break;
                    }
                }
            }
            EditorGUI.EndProperty();
        }
Example #29
0
        public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) 
        {
            float value = 0f;
            if (property.propertyType == SerializedPropertyType.Float)
            {
                value = property.floatValue;
                isNumericValue = true;
            }
            else
            if (property.propertyType == SerializedPropertyType.Integer)
            {
                value = (float)property.intValue;
                isNumericValue = true;
            }
            else
            {
                isNumericValue = false;
            }

            if (isNumericValue)
            {
                ProgressBarAttribute barAttribute = (ProgressBarAttribute)attribute;
                EditorGUI.BeginProperty(position, label, property);
                EditorGUI.ProgressBar(position, (value / barAttribute.max), label.text);
                EditorGUI.EndProperty();
            }
            else
            {
                EditorGUI.BeginProperty(position, label, property);
                EditorGUI.PropertyField(position, property);
                EditorGUI.EndProperty();
            }
        }
Example #30
0
	public void OnEnable () {
		serObj = new SerializedObject (target); 
		
		reflectionMask = serObj.FindProperty("reflectionMask");   		
		reflectSkybox = serObj.FindProperty("reflectSkybox");   		
		clearColor = serObj.FindProperty("clearColor");   		
	}