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 TheSuburbanHero · May 15, 2012 at 05:38 PM · editorexecuteineditmodeedit mode

What Does "ExecuteInEditMode" Actually Do?

So, this is my first Unity project and also my first experience with Javascript, coming from a novice background in Python. I am currently building the "Lerpz" tutorial project, and I'm wondering what the "ExecuteInEditMode()" script does? Does it mean that the script will run even when the "Play" button hasn't been pressed? Or does it just mean that it will run within the Editor as opposed to a build? Specifically, shouldn't the menu show up even when the game isn't in "Play" mode?

Here's the code: @script ExecuteInEditMode() //Makes the script also execute in edit mode var gSkin : GUISkin; var backdrop : Texture2D; // our backdrop image goes in here private var isLoading = false; // if true, we'll display the "Loading..." message

function OnGUI() { if (gSkin) GUI.skin = gSkin; else Debug.Log("StartMenuGUI: GUI Skin object missing!");

var backgroundStyle : GUIStyle = new GUIStyle();//creates new GUIStyle object backgroundStyle.normal.background = backdrop;//makes the "normal.background" (a style element) to our background image

GUI.Label ( Rect( (Screen.width - (Screen.height 2)) 0.75, 0, Screen.height * 2, Screen.height), "", backgroundStyle); //creates screen that will remain proportional to screen size GUI.Label ( Rect( (Screen.width/2)-197, 50, 400, 100), "Lerpz Escapes", "mainMenuTitle");//creates a label on the screen

if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 160, 140, 70), "Play")) { isLoading = true; Application.LoadLevel("TheGame"); // load the game level. }

var isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer); if (!isWebPlayer) { if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 80, 140, 70), "Quit")) Application.Quit(); }

if (isLoading) GUI.Label ( Rect( (Screen.width/2)-110, (Screen.height / 2) - 60, 400, 70), "Loading...", "mainMenuTitle"); }

Thanks for any help and sorry for possible noob-ness.

Comment
Add comment · Show 1
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 Lo0NuhtiK · May 15, 2012 at 05:45 PM 0
Share

ExecuteInEdit$$anonymous$$ode
Executions

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by kolban · May 15, 2012 at 05:45 PM

Here is the Internet manual page that describes "ExecuteInEditMode". This page seems to describe all that is needed. Have a read at the manual page and please feel free to come back with additional questions to clarify what you read at the manual page.

http://unity3d.com/support/documentation/ScriptReference/ExecuteInEditMode.html

Comment
Add comment · Show 1 · 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
avatar image pengo · Sep 13, 2013 at 05:33 AM 2
Share

Documentation has moved:

http://docs.unity3d.com/Documentation/ScriptReference/ExecuteInEdit$$anonymous$$ode.html

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

7 People are following this question.

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

Related Questions

Manually triggering a script from the editor (utility, macro etc.) 1 Answer

How does the particle emitter update in edit mode? 1 Answer

Run script in Edit mode when paused? 3 Answers

Perform action on save/load in editor 2 Answers

Custom Asset Icons? 2 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