Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Neo-Gamefactory · Jun 06, 2014 at 10:47 AM · windowcustom style

My Custom Style changes everything in the Editor, why?

Hi there,

i have one Big Problem...

I made a Customn Style for my Custom Editor Window and it works....but it changes also the Editor built in Stuff...

In my Window i want a Big Label as a Toolbar, because a Toolbar looks great, i set the Fix height to 50 and it works.... but THEN, it change all Toolbars in the Editor to 50. I have no Idea why. Because i used a Custom Style...

Heres comes the code:


 using UnityEngine;
 using System.Collections;
 using UnityEditor;
 
 public class SHS_SpawnSystemWindow : EditorWindow {
 
     GUIStyle logoSHS = new GUIStyle ();
     public Texture2D logo;
 
     [MenuItem ("SHS/Shit SpawnSystem")]
     public static void ShowWindow ()
     {
 
         EditorWindow.GetWindow (typeof (SHS_SpawnSystemWindow), false);
 
 
        
     }
 
     void Awake ()
     {
 
         logo = Resources.Load ("logo_shs") as Texture2D;
 
     }
 
     void OnGUI ()
     {
 
         logoSHS.fontSize = 50;
         logoSHS.fontStyle = FontStyle.Bold;
         logoSHS.normal.textColor = Color.white;
         logoSHS = EditorStyles.miniButton;
         //logoSHS.fixedHeight = 80;
         logoSHS.padding = new RectOffset (0, 0, 0, 0);
         logoSHS.margin = new RectOffset (0, 0, 0, 0);
 
         GUI.backgroundColor = Color.black;
         EditorGUILayout.BeginVertical (logoSHS,GUILayout.Height (125));
         GUILayout.FlexibleSpace ();
         GUI.backgroundColor = Color.grey;
         EditorGUILayout.BeginHorizontal ();
 
 
         GUILayout.Label ("Shit SpawnSystem", logoSHS, GUILayout.Height (100));
 
 
 
         GUILayout.Label (logo, logoSHS, GUILayout.Height (100), GUILayout.Width (100));
 
 
         EditorGUILayout.EndHorizontal ();
 
         GUILayout.FlexibleSpace ();
         EditorGUILayout.EndVertical ();
         
         
     }
     void OnDestroy () //this was a test, but also doesn't work
     {
         logoSHS=null;
         Debug.Log ("geschlossen");
     }
 }
 



not normal!

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nerevar · Jun 06, 2014 at 10:52 AM 0
Share

well as it is said in the doc if you assign fixedHeight , any GUI elements rendered with this style will have the height you specified.

I don't see where it changes Built-in stuff...

avatar image Neo-Gamefactory · Jun 06, 2014 at 05:48 PM 0
Share

Here...that is what i mean! Changing everthing... also the Font Size_/Color..... and so on! and THIS.. is not normal! I create a custom style and don't edit the default one!

Picture of the error

avatar image Landern · Jun 06, 2014 at 05:55 PM 0
Share

Is the 'Shit SpawnSystem' on the asset store? :)

avatar image Neo-Gamefactory · Jun 06, 2014 at 06:10 PM 0
Share

No ;) but i want to sell it later on the Asset Store... (maybe 15$) The System works but this GUI Design Elements are going Crazy.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Ogdy · Aug 13, 2018 at 11:39 AM

Probably way too late, but here is the anwser for others :

logoSHS = EditorStyles.miniButton;

logoSHS.padding = new RectOffset (0, 0, 0, 0);

logoSHS.margin = new RectOffset (0, 0, 0, 0);

Here you are giving logoSHS the same reference as EditorStyles.miniButton, so when you do :

logoSHS.padding = new RectOffset (0, 0, 0, 0)

you are in fact also doing :

EditorStyles.miniButton.padding = new RectOffset (0, 0, 0, 0)

and EditorStyles is used everywhere, so it changes everywhere :)

What you can do is simply make a copy, like this :

logoSHS = new GUIStyle(EditorStyles.miniButton)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Cloud recognition in Vuforia 0 Answers

Can I use Pro features? 1 Answer

on start a new game texture is not appearing 0 Answers

Move Object by dragging (mobile) makes the balls fall from the cup 1 Answer

How can I Pool array of objects? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges