Example #1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        //EditorStyles.objectField
        //EditorGUIUtility.PingObject( 1092 );


        var scriptProperty = serializedObject.FindProperty("m_Script");

        EditorGUI.BeginDisabledGroup(true);
        EditorGUILayout.PropertyField(scriptProperty);
        EditorGUI.EndDisabledGroup();

        ParallaxScroll manager = ( ParallaxScroll )target;

        //string[] guids = AssetDatabase.FindAssets( "t: Script ParallaxScroll" );
        //if ( guids.Length != 0 ) {
        //	Debug.Log( guids.Length );
        //	var path = AssetDatabase.GUIDToAssetPath( guids[ 0 ] );
        //	Object target_object = AssetDatabase.LoadAssetAtPath( path, typeof( Object ) );

        //	EditorGUI.BeginDisabledGroup( true );
        //	EditorGUILayout.ObjectField( "Script", scriptProperty, typeof( Object ), true );
        //	EditorGUI.EndDisabledGroup();

        //}



//		EditorGUILayout.PropertyField( scrollWayProperty );
//		EditorGUILayout.PropertyField( scrollDirectionProperty );
        EditorGUILayout.PropertyField(scrollBaseSpeedProperty);
        EditorGUILayout.PropertyField(smoothStartProperty);
        EditorGUILayout.PropertyField(smoothDurationTimeProperty);

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(createScrollUnitProperty);
        if (EditorGUI.EndChangeCheck())
        {
        }

        EditorGUILayout.Space();

//		EditorGUILayout.PropertyField( sortingLayerProperty );

        var selectedIndex = sortingLayerNameList.FindIndex(item => item.Equals(sortingLayerNameProperty.stringValue));

        if (selectedIndex == -1)
        {
            selectedIndex = sortingLayerNameList.FindIndex(item => item.Equals("Default"));
        }

        int new_selected_index = EditorGUILayout.Popup("Sorting Layer", selectedIndex, sortingLayerNameList.ToArray());

        if (selectedIndex != new_selected_index)
        {
            manager.SetSortingLayer(sortingLayerNameList[new_selected_index]);
        }

        EditorGUILayout.PropertyField(orderInLayerStartProperty);
        EditorGUILayout.PropertyField(orderInLayerInterval);

        objectList.DoLayoutList();

        //ParallaxScroll manager = ( ParallaxScroll )target;

        //DrawDefaultInspector();

        //if ( GUILayout.Button( "Create" ) == true ) {

        //	manager.CreateScrollObject();



        //}

        if (createScrollUnitProperty.intValue < 1)
        {
            createScrollUnitProperty.intValue = 1;
        }

        serializedObject.ApplyModifiedProperties();
    }