x


Styles on an EditorWindow/Editor script

Hi every one, I'm working on a tool for unity and I want to make it using the "EditorWindow" class, everything it's ok, now my problem is this:

class MyWindow extends EditorWindow {

var scrollTex : Vector2;
var guiSkin : GUISkin = Resources.LoadAssetAtPath(Assets/Editor/_Skin/MyGUISkin.guiskin);
--
-The ini() goes here-
--
function OnGUI () {
    GUI.skin = guiSkin;
    var mystyle : GUIStyle = GUI.skin.GetStyle("MyStyle");
    scrollTex = EditorGUILayout.BeginScrollView(scrollTex, mystyle, GUILayout.Width(150));
    EditorGUILayout.EndScrollView();
}
}

and end with this: Assets/Editor/MyWindow.js(73,79): BCE0023: No appropriate version of 'UnityEditor.EditorGUILayout.BeginScrollView' for the argument list '(UnityEngine.Vector2, UnityEngine.GUIStyle, UnityEngine.GUILayoutOption)' was found.

I read the manual and found this: static function BeginScrollView (scrollPosition : Vector2, alwaysShowHorizontal : boolean, alwaysShowVertical : boolean, horizontalScrollbar : GUIStyle, verticalScrollbar : GUIStyle, background : GUIStyle, params options : GUILayoutOption[]) : Vector2

I want to apply my style in the "background", how can this be possible?. Thanks for your help in advance. :-)

more ▼

asked Sep 19 '11 at 03:52 PM

3D-Magic-VR gravatar image

3D-Magic-VR
41 12 14 15

I regret the delay, but I found the answer to this little problem.

Oct 28 '11 at 11:39 PM 3D-Magic-VR
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I found the answer to this little problem, if we use a GUISkin either the inspector or a floating window, we must use it without modifying the components already in place and just keep adding the styles that we will use, in this case values ​​are used ScrollViewer (visible vertical, horizontal visible, style vertical bar and horizontal bar style) and only change the background style.

You can check this too, it show how it's looks.

more ▼

answered Oct 28 '11 at 11:57 PM

3D-Magic-VR gravatar image

3D-Magic-VR
41 12 14 15

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1665
x111
x47

asked: Sep 19 '11 at 03:52 PM

Seen: 1295 times

Last Updated: Nov 10 '11 at 07:17 PM