Hot answers tagged

9 votes
Accepted

Mute sound in editor in Unity

In the Scene view, you will find a little toggle, near the 2D toggle, at the right of the lightning toggle (with a little sun ...
Hellium's user avatar
  • 2,959
7 votes
Accepted

Start debug window on other monitor than the Godot editor

Look in the "Editor" menu, option "Editor Settings...", then Run > Window Placement > Screen.
jzq's user avatar
  • 86
6 votes
Accepted

How to inspect/modify the runtime state of a node in the Godot editor?

You can do so, although Godot's behavior is slightly different to Unity and I'd suggest trying it in a small test project before you unintentionally change an actual working project. The functionality ...
Mario's user avatar
  • 8,442
5 votes
Accepted

How to make Unity Layout switch while in Play mode

After reading Unity API, I found the solution! It's absolutely possible to change the Unity layout during the Play Mode. We can ...
Emad's user avatar
  • 1,136
5 votes

How can two people simultaneously edit one game project?

You can take a look at SceneFusion for Unity, which is free for up to 2 users and a limited number of GameObjects in the scene. That should work well with your requirement of needing C#. If you want ...
Ignis Incendio's user avatar
4 votes

How to make an EditorGUILayout.TextField accept multi-line input in a custom inspector

Ok, so this works as an alternative: EditorGUILayout.PropertyField(message, GUILayout.Height(80));
Jeff Graw's user avatar
4 votes
Accepted

Is there a way to run a tool script without attaching it to a node in the scene tree?

In this answer I present a few approaches to run code in the editor. The first one is pretty much what you are already doing. If that is an option for you, it is an option for you. The second is using ...
Theraot's user avatar
  • 25.2k
3 votes
Accepted

C++ - How to create an engine editor without frameworks like qt and wxWidgets?

If you don't want to use frameworks like qt, wxWidgets, then you'll have to either: Use the platform windowing API (WINAPI, XLib, Cocoa). Write your own widget toolkit and render it yourself using ...
JBeurer's user avatar
  • 452
3 votes

Update dependent values of Serializable C# classes on Inspector

You can use a MonoBehaviour or ScriptableObject's OnValidate() method. This gets called in the Editor when a script instance gets (re)loaded or when Inspector properties are changed. It won't ...
DMGregory's user avatar
  • 132k
3 votes
Accepted

how to get current zoom level from scene window

To get the Handles.Label function to work in different zoom levels you need to change two things: Use the function signature that accepts ...
lilotop's user avatar
  • 584
3 votes

Custom editor script not updating when values are changed from script?

Override RequiresConstantRepaint(): https://docs.unity3d.com/ScriptReference/Editor.RequiresConstantRepaint.html
Superpig's user avatar
  • 250
3 votes

Custom editor script not updating when values are changed from script?

I just ran into this problem for the first myself... surprised there's no answer to be found anywhere. After poking at it for a bit, I found a solution myself. Turns out, an inspector doesn't repaint ...
Morhe's user avatar
  • 39
3 votes
Accepted

Is there a way to customize the Game-view Editor GUI?

Simple answer would be no, you can't. This is done in this internal class (In the 'DoToolbarGUI' private method to be precise), meaning you can't just overwrite it easily. See also this question if ...
troien's user avatar
  • 906
3 votes
Accepted

How to reference nameof private serialized field in unity custom inspector

Use your interface Handily enough, you already have your answer. Leave the speed field public, but never pass around or declare references to that class. Only ever ...
Ed Marty's user avatar
  • 5,219
3 votes
Accepted

How to run 'Call in Editor' Functions that are implemented in Level Blueprints?

I don't think that's possible. Direct quote from the offical docs on " Calling Blueprints in the Editor" The steps described below work for any Blueprint class that you can place in a Level—that is,...
Zenahr's user avatar
  • 146
3 votes
Accepted

Unity Editor extension to group scripts attached to an object

I strongly recommend consolidating your scripts so that you don't have hundreds of components on one GameObject. There are many reasons not to get this carried away with components, some of which I ...
Kevin's user avatar
  • 4,961
3 votes
Accepted

Does MonoBehaviour have a method that is called in editor when the object is created?

Yes, OnValidate() gets called only in the Editor (including play mode in-editor) in a few situations: When the component is added to a game object When a prefab ...
DMGregory's user avatar
  • 132k
2 votes
Accepted

How can I see whether my sprite is .png or .jpg in the Inspector view or some place alike in Unity?

Is it right your question just show the extensions of sprite in Unity Editor? That's simple. You just change to 2 Column Layout of Project window.
whoo24's user avatar
  • 71
2 votes

Update dependent values of Serializable C# classes on Inspector

In my opinion I these variables should be treated separately. Use your properties methods as just interactor to that one variable alone. Putting logic in them is a bit smelly I think. The setter for ...
Matster2's user avatar
2 votes

Unity SceneView Positionning object with mouse position in Editor script

Ok, After a lot of research, I finnalt got this to work: ...
Ugo Hed's user avatar
  • 281
2 votes
Accepted

Prevent VS Code opening the Unity scripts twice

Thanks to baheard I believe it was related to upgrading a project to a new version of unity. I resolved it by deleting the .csproj files and the .sln file form the project folder. Unity will just ...
Swati's user avatar
  • 1,147
2 votes
Accepted

Load scene without being in build settings and without using AssetBundle

Turns out there's EditorSceneManager.LoadSceneInPlayMode which does exactly what I'm looking for! Awesome. I had asked on the Unity Forum and found the answer ...
Bilal Akil's user avatar
2 votes

Unity Event Pause/Unpause & jump frame

Because you can determine when the pause button is pressed you can use this to then deduce when a "jump frame" would have occured. Essentially, when its in pause, one "frame" would call the update ...
Vitulus's user avatar
  • 121
2 votes

Is there a way to customize the Game-view Editor GUI?

I made a custom toolbar. I uploaded it in my github
Seyed Morteza Kamali's user avatar
2 votes
Accepted

Unity List script field with +/- buttons in editor

you can use NaughtyAttributes NaughtyAttributes is an extension for the Unity Inspector. It expands the range of attributes that Unity provides so that you can create powerful inspectors without the ...
Seyed Morteza Kamali's user avatar
2 votes
Accepted

How can I add word wrap to EditorGUILayout.TextArea?

In essence, You need to make sure that the style that is used has wordwrap set to true. The problem with what you tried is that the style you edited isn't used by the TextArea. Which style is used is ...
troien's user avatar
  • 906
2 votes
Accepted

Border around game preview window

Make sure you have "Low resolution aspect ratios" ticked OFF under the aspect ratio tab: That should make the game view as big as possible, but the actual aspect ratio (e.g. 16:9) may still ...
Eldemarkki's user avatar
2 votes

How to organize GameObjects into logical groups in a Unity Scene?

Use marker-components. The penalty of having a marker-component with no fields and no methods on a lot of objects will in most cases be negligible. But when you are in a situation where every byte ...
Philipp's user avatar
  • 118k
2 votes
Accepted

Editor-only MonoBehaviour (not GameObject)

You can wrap your whole class in an #if UNITY_EDITOR preprocessor directive so that in a build it compiles to an empty file, like this: ...
DMGregory's user avatar
  • 132k

Only top scored, non community-wiki answers of a minimum length are eligible