Hot answers tagged

31 votes
Accepted

How to edit key-value pairs (like a Dictionary) in Unity's inspector?

One quick way to get key-value pairs in Unity's inspector is to define a serializable entry class, and then use an array or List<> of them. eg... ...
user avatar
  • 114k
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 ...
user avatar
  • 2,919
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 ...
user avatar
  • 1,126
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 ...
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));
user avatar
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 ...
user avatar
  • 442
3 votes
Accepted

How to edit colliders in Unity2D

In Unity 4.6 there's a dedicated button in Inspector labeled "Edit Collider" that you could use to edit the collider.
user avatar
  • 981
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 ...
user avatar
  • 574
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 ...
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 ...
user avatar
  • 866
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 ...
user avatar
  • 3,505
3 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 ...
user avatar
  • 18.5k
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.
user avatar
  • 61
2 votes

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

Override RequiresConstantRepaint(): https://docs.unity3d.com/ScriptReference/Editor.RequiresConstantRepaint.html
user avatar
  • 240
2 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 ...
user avatar
  • 114k
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 ...
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: ...
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 ...
user avatar
  • 1,097
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 ...
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 ...
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
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 ...
user avatar
2 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 ...
user avatar
  • 5,189
2 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,...
user avatar
  • 136
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 ...
user avatar
  • 866
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 ...
user avatar
  • 112k
2 votes
Accepted

Unity gameObject character stuck in T pose for scene but animations work fine when playing game

Welcome! By default, your model will always be on TPose in Edit Mode, this is because the skeleton of your model was setup like that when it was modeled by Mixamo. The only way to display, or preview ...
user avatar
1 vote

Unity GameObject.Find() not working in batchmode?

When running in batchmode, Unity does not load the scene you normally see when opening the project in the editor. Thus, there are no GameObjects to find. If you ...
user avatar

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