#↕️┃editor-extensions
1 messages · Page 37 of 1
hmm... Honestly, in this case it sounds like it could be a fix for it. I will try and see
yeah, it seems to work so far! 👀 Thanks
i made a custom property drawer but i seem to get this in the inspector, no idea why
what does that usually suggest is wrong with it
i get no compile errors
[CustomPropertyDrawer(typeof(TestMeshComponent))]
public class TestMeshComponentPropertyDrawer : PropertyDrawer
{
static string[] sharedProps = { "Name", "Type", "Mesh", "Materials", "Layer", "IsStatic", "Offset" };
public override VisualElement CreatePropertyGUI(SerializedProperty property)
{
var root = new VisualElement();
PropertyField[] sharedFields = new PropertyField[sharedProps.Length];
for (int i = 0; i < sharedFields.Length; i++)
{
sharedFields[i] = new (property.FindPropertyRelative(sharedProps[i]));
root.Add(sharedFields[i]);
}
return root;
}
}
Hi. I want to compute effect in Editor window too. I need access to transform-like component of the implicit editor camera at C# level. I need to extract location/fov/far plane/near plane of the Editor camera as read-only data. What API could I use in Unity 6.3 LTS? It's fine for my project to use undocumented and "likely to be changed in the future private C# API" .
You can access the camera used in the scene view quite easily! You can also modify its settings but I forget if you have to refresh something after.
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/SceneView-camera.html
has anyone been getting this error when downloading a package Unity 6.3 LTS. Im trying to install unity recorder
Isn't there some trick with assembly definitions to allow you to access the internals of a package? Or am I misremembering?
Yes, you can create an Assembly Definition Reference to add code into another assembly definition from another folder. This only works if the package has source code and an assembly definition.
Wait... it was that easy!? Thanks! You just saved me hours of reflection!
There's also some specific assembly names that Unity has marked as friend assemblies
is there an equivalent to OnDrawGizmos for the editor window class?
im using VertxDebugging. as it turns out, you can just use Update() in the EditorWindow class
so ima just do that
Not sure Gizmos work in update?
its a bit finicky
It sure is
Does Editor work in the EditorWindow class?
VertxDebugging probably works similar but I have no idea about that package
thise seems to be more stable, thank you!
I am trying to create a custom editor window which shows a preview for each prefab in a library folder.
I tried using EditorSceneManager.NewPreviewScene to render the prefabs as textures. I created a new camera and did MoveGameObjectToScene, but rendering my camera still just renders my current active scene instead..
And I tried using a PreviewRenderUtility, but could never get it to work. I got it to show an image, but it was pitch black, no matter what I did with light settings/intensity(70k+). And I dont see my object at all, even when trying to give it an unlit shader.
Does anyone know how I can render a prefab as a texture onto my editor? I want it to look like this image. I already have it creating the buttons & images, just cant get the object rendering right..
And I cant just use the prefab's image itself, because I want to be able to change the color/material in my editor window and have the pieces all live update to that color in the window.
ill look into it ^-^, what render pipeline are you using?
What I do is basically copy what Unity's GameObjectInspector does https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/Inspector/GameObjectInspector.cs#L1216
Unity 6.3, HDRP
Ill have a look into that, thanks.
I couldn't really get it working well, so I opted to use a camera.render to get a RenderTexture 1 time and save the image as a png in my asset browser, and then use a colouring function to change the icon colours instead of changing materials & re-rendering. I assume this might be faster anyways, but not sure.
Has to get each image from asset browser again, but doesn't have to re-render each image.
im trying to make a window, but when i expand things in the property drawer, it expands upwards and takes up space with the other buttons. How can i make it expand downwards?
never mind fixed it, the parent had flex grow incorrectly
Ongui defaults can be dumb so you often have to disable flex everywhere to stop this
Hi, i have this issue do you know if its a known bug ? And if it has a fix
You're having networking issues.
wdym ? I have no network issues except for this
It'd be possible for you to have a problem with Unity, but still be able to visit other websites
however, other people are having this problem
so it's probably not on your end!
k thank, i hope it will be fix before the end of the Global Game Jam 😅 🙏
oh, that's really bad timing :x
If I have a ListView that's bound using binding-path how can I retrieve the target element if I override BindItem?
The default list view entry template contains a button that I'm trying to query for while retaining the "default" BindItem behaviour for the rest of the template
To answer myself:
How can I clear a property field?
I tried .Unbind() and .bindingpath = null but neither worked
I have a script that executes in both editor and playmode and handles the drawing of instanced grass on my custom terrain system. I've been noticing a constant detection of memory leaks on domain reload and I'm not sure how to solve it. I always dispose of the compute buffers whenever they're not in use (which in this case will be whenever the script is destroyed/disabled), should I be also disposing on domain reload as-well?
The memory leaks seem to ONLY occur on domain reload, they do not appear to happen on entering/exiting playmode.
Is this a monobehaviour or no? If not id try to use the exit play mode/exit Application event to dispose.
You could also try using a destructor but if you get infinite domain reloading then undo that.
Its a monobehaviour, yes
I tried releasing and then reinitializing the compute buffers using the OnAssemblyBeforeReload and OnAssemblyAfterReload. In OnAssemblyBeforeReload, I release the buffers and in OnAssemblyAfterReload I reinitialize them to the saved instance data of the terrain
But there's still a memory leak apparently
wait no, there doesn't appear to be a memory leak anymore. I was getting confused by an earlier leak detection in the console.
Great! Managed objects using native resources need to handle this otherwise the native memory will leak.
Though why this isnt rigged up to happen with destructors on the manged objects is odd
Hi ! I know it's possible to automatically dock a window next to another one trough thise method EditorWindow.GetWindow<T>(params Type[] desiredDockNextTo) but is it possible to manipulate the tab order through code ?
Like, I'd like to ensure my window is always at second place or something like that
Theoertically with lots of reflection probably
I think you can get the parent DockArea from EditorWindow https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/EditorWindow.cs#L176C18-L176C27
Then you can call RemoveTab/AddTab to move them around https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/DockArea.cs#L192
Or you can try manually editing m_Panes
@gusty mortar
Ah nice, thanks for pointing the direction
Since this server doesn't have a shaders channel anymore I'm not really sure where to place this other than here.
I'm trying to write a custom render pass for URP which:
- Renders the scene similar to a GBuffer but with some important differences (I can handle the 'differences' part)
- Takes the resulting texture from the step above and creates a mask for outlines, which can then be sampled in a shader attached to an object
Documentation for writing custom render passes using render features (especially w/ render graph) is basically non-existant and was less than useless to me. I have no real idea on how to continue past making a basic skeleton class containing the scriptable render feature and the associated pass. I also looked at the URP samples you get from the package manager and they also didn't really help me figure out anything.
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering.RenderGraphModule;
public class _3DPixelArtFeature : ScriptableRendererFeature
{
[SerializeField] private _3DPixelArtFeatureSettings settings;
private Shader _shader;
private Material _material;
private _3DPixelArtFeaturePass m_ScriptablePass;
/// <inheritdoc/>
public override void Create()
{
if (_shader == null)
{
_shader = Shader.Find("Custom/PixelArtNormalPass");
}
_material = CoreUtils.CreateEngineMaterial(_shader);
m_ScriptablePass = new _3DPixelArtFeaturePass(settings)
{
renderPassEvent = RenderPassEvent.AfterRenderingOpaques,
};
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(m_ScriptablePass);
}
[Serializable]
public class _3DPixelArtFeatureSettings
{
}
public class _3DPixelArtFeaturePass : ScriptableRenderPass
{
private readonly _3DPixelArtFeature._3DPixelArtFeatureSettings settings;
public _3DPixelArtFeaturePass(_3DPixelArtFeature._3DPixelArtFeatureSettings settings)
{
this.settings = settings;
}
public void Setup(Material material, RenderTargetIdentifier source)
{
}
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
{
}
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
//Render the scene similar to a GBuffer using the supplied shader & material
}
public override void FrameCleanup(CommandBuffer cmd)
{
if (cmd == null) return;
}
}
}
I think you would have better chances of getting an answer by opening a new post in #1390346776804069396
There's a template for a custom renderer feature/render pass that uses Render Graph and has a bunch of comments that are basically like a tutorial. It's somewhere in the Create context menu, under Rendering or URP.
I looked at that, it didn't really help explain (infact, I'm pretty sure that's the exact thing I used to create the skeleton class I shared)
Everything I find that explains how to render to a custom pass that can then be sampled from another script is using old APIs that don't do anything in Unity 6. Think I'm just going to have to skip writing my own pass for now.
I know there are a lot of packages that allow for creating Hierarchy Folders. However, I wanted something very simple that I could give to my students and also practice making a Unity extension. And so I put together Simple Hierarchy Folder a simple little tool that does what it says.
If anyone would like to make use of it you can get it here https://github.com/ProfessorAkram/SimpleUnityHierarchyFolder?tab=readme-ov-file
Also feel free to let me know if any improvements could be made.
Thanks 😊
I wanted to work on my project when im not home so i copied it to a USB stick and boot it up on my laptop, downloaded the unity exnetsions to VS 2022 and yet the intellesense doesnt work, tried everything, regenerated my files 5 times, made sure im on the right external editor, repaired my vs twice and yet still nothing works, im stuck, any help please?
It is related to temporally directories of the project. Some of them contain absolute paths. I suggest to remove those files and reopen the project.
# Unity stuff
Library/*
Temp/*
Obj/*
Builds/*
Logs/*
UserSettings/*
<project name>.slnx
Assembly-CSharp.csproj
You should look at using unity VC or git (with github) to have tracked history and online hosting
Good day
I'm not sure if this counts as an editor extension. I am getting lost. I have looked online, and I am unable to make heads of how I can do what I want to do.
I am busy building an editor window to create dialogue trees for my project. I am using it with the Unity localization system, pulling the dialogue strings directly from the localization table.
I am looking at a way to put the Localized String Picker in my editor Window.
As the picker in the inspector, but in the editor window, instead of the current text field where I am just changing the value of the string, within the node, is there a way to do it?
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
Right... how do I fix that?
Configure it using the instructions I linked, then resolve the obvious errors
Forgive me for being stupid, but could you link me directly instead of making me search for it, I don't magically know exactly what you're talking about.
I have the editor package installed and up to date, and yet it still hasn't resolved the issues.
Seems I just forgot semicolons...
could i use C++ in Unity?
Use in what way (and why)? Regardless the answer is likely no. There might be some asset that allows that to some degree but unity only supports C# as a scripting language by default
like for scripts
no
C# is the only scripting language officially supported
you can go down this route but i dont think this is what your looking for https://docs.unity3d.com/6000.3/Documentation/Manual/plug-ins-native.html
Is there a specific reason you want to use C++ over C#?
You can use cpp code but dont expect to interact with any unity apis. Its not like godot where its exposed
hi, im trying to make a scene-like hierarchy preview in an editor window and I;ve tried using PreviewRenderUtility to do it. I have an issue where the character doesnt render correctly and I was wondering if anyone maybe knew from this code snippet if I was perhaps missing something or whether the method I'm using just wouldn't work for this at all?
For context, PreviewLayout() is called in the window's OnGUI,
InitialisePreview() is called in the window's OnEnable(), CleanUpPreview() and ResetPreview() are called in response to field changes elsewhere in the code
ok resolved it apparently by default Render doesnt allow scriptable render pipeline
how do you create an empty scene when using an editor tool so the rest of the scene is not in the way?
then restore it when you close the editor window
If you want something like the prefab stage: https://docs.unity3d.com/6000.3/Documentation/ScriptReference/SceneManagement.PreviewSceneStage.html
more like temporary hide everything in active scene
I've not used it before (a custom stage), but the prefab stage has the capability to hide, fade, or isolate the other scenes
is there a way to know in an editor if a monobehaviour is inside the DOTS subscene vs regular scene? I need to display different UI if its part of DOTS or not so knowing the scene type it is part of is needed
I thought mono behaviours by definition don’t exist in a sub-scene?
hey guys is there something like this: [CustomPropertyDrawer(typeof(List<CustomClass>))] ?
The custom class draws fine, I'm just trying to add labels to each index to match an enum's titles.
Basically just trying to replace "Element 0", "Element 1" with custom names
IIRC, you can simply add a Name field to your custom class. Unity will bound the Name value to the element's label
You can maybe make a drawer for the custom class that just draws a different name (if instance is part of a list) 🤔
That would defeat the purpose that is making sure the elements match an enum, as you'd depend on the person to make sure they match anyways.
just a vibe check; im pretty sure there isn't a good way to do this (which is really shit)
Haha yeah that is literally what I was asking about, the solution was to make a custom attribute i got it here if anyone else needs it: https://discussions.unity.com/t/naming-array-elements-in-editor/25158/4
Hey guys, has anyone ever used an fbx modifying asset that transfers units to other units? For example, id like to fix some .fbx by converting cm to m
Cascedeur for some reason exports in cm, which is quite annoying as the rig is at a object scale of 100
Unity fbx importer already has scale conversion settings, isn't that enough?
Select an FBX in unity and look at the inspector, IIRC the first 2 options are scale related
No
I figured it out
Had Claude make me an editor tool where I right click the fbx, and hit a button that automates fixing the scaling issue in blender
cool now go see what it actually did and learn the right way
Calm down buddy Its 50 lines of code, it just runs 3 commands to open the file in blender, import the fbx, and export with specific settings
Claude/ai is trash for anything meaningful
unity can already alter scale on import and bake axis conversion so this seems a bit much
not that its useful to automate this kind of fix but not great long term
I wasnt able to get it to apply object scaling to the rig, it always sat at 100 local scale relative to the root
Exporting from my animation software left the rig in cm instead of m
So my animations werent retargeting
The animation software didnt let me apply unit scaling when exporting
Weird, humanoid anim retargeting should work if the bone hierachy fits the expected state
The humanoid bones work but I need the non-humanoid bones to work too
Ah well then you cannot use the humanoid rig mode
You can, hence why I need proper scaling
It works and this tool solves my problems
Ive not had much success before myself 🤔
Ive had extra bones in animations just not function till changing the mode back
But its been a few years
Under the animation tab you need to select "Mask" "create from this model" and select All the bones you want unity to include in the animation data
As long are your rigs are 1:1 it works just like generics with same rig animations
Ah well back then the artists made it all so i didnt have to retarget so I didnt care to try more 😆
thanks for the info
No problem, another reason why im using ai for this
I cant be the modeler, animator, programmer, networker, and the blender/python tooler
Id rather just save myself the 2 hours of googling
Cause its simple implementation, but you always need to adhere to formatting and such which is absolutely useless knowledge
its thankfully very easy to import a model into blender, apply scale and export
100%, now do this for all 20 animations per weapon for 10 weapons 😅
does anyone have a solution for the laggy animation clip player?
I fixed it by using dx11 instead of dx12 on the editor, through project settings->player->other settings
Reserved for Editor scripts, which add functionality to the Unity Editor at authoring time but aren’t available in Player builds at runtime.
Ok nice but does this mean that everything placed inside the Editor folder is not included in the final game build or just those scripts in there?
The folder is ignored during by the final build. Another example:
If you add a Resource folder inside your Editor folder and add some icons (Texture2D) inside it, these textures won't be available in build.
I think thats wrong, it only puts scripts into an editor only assembly
assets in there work as normal
nvm it seems Resources is an exception, other assets will remain
hopefully this is the right place to ask this, is there a way to get the editor to shift the text of the Hierarchy based on the size of its window? the left image shows how it currently works and i'm looking to get it to work like the image on the right
dealing with very limited screen real estate and would like to find ways to save space
just not sure why there is a big gap between the object type and the pick/visibility setting
maybe it is for when you have multiple Scene's but there is already a drop down and seperation between each scene and its objects so im not sure it makes sense
realized i posted about this exact same thing in 2024, lol
need a "text wrapper" guess its still not possible
Yeah, I should have been more precise that it's only true for the Resources folder
Which unity version are you on?
Unity 6.3 introduced the new hierachy (Preferences -> General -> Use new hierarchy)
You can resize, switch positions and disable any column:
One day unity will change object icons based on components without me needing a third party solution
you mean the new new hierarchy™ ?
Ive yet to use it but would be nice if that was also a feature in that
oh right my brain did not even notice the extra new
i can't add probuilder window to my toolbar - i drag and drop and nothing happens
im now creating the UI for this game, and i ahve a problem with the bottom part of the UI. i need it to be lower than the world (the white line across the screen)
An error occurs when trying to view assets
modding cannot be discussed in this server
oh, that's neat!
good to know
It's strange because we can just load any asset in editor.
In the past I just automated deleting a certain folder to remove stuff from builds 😅
i mostly just load editor-only resources by their GUID+FileID
I was under the impression ScriptableSingleton + serialized references was the ideal choice for this kinda thing, no?
There are some places that you can't actually serialize a reference in the inspector
e.g. a custom property drawer
in that case, I use the GUID+FileID to load a visual tree asset, then instantiate and display it
I like that approach because it's completely immune to asset renaming and moving
I repeatedly footgunned myself by moving assets and forgetting that cared about the exact path to the asset somewhere
For some reason resizing with scaling is causing these weird decimal placements even though the grid snap is set to 0.5
totally unrelated, but how did you enable these measurements?
I turned them on once and could never figure out what I did
The magnet thingy
and grid size
you can also hold shift or ctrl I think to move without snap
i'm talking about the red/green/blue lines you see around the box
they're telling you how large its bounds are
is there any api let me toggle the hand thing in code
SceneVisibilityManager.instance.DisableAllPicking();
nvm
Hello, my editor crashes randomly when I try to add items to an array through the inspector. I don't understand why and the error in the log looks like this. Any idea of what or why is this happening? Is this a known Unity Bug?
If you have a custom editor, then you might be doing osmething weird, but if you don't, try updating unity
I am trying to get a List or Array of a custom class to show up in the inspector, anyone know what I need to do?
[Serializable]
private class EffectData
{
public string ReferenceName { get; set; }
public float Value { get; set; }
}
[SerializeField] private EffectData[] effects;
I have this code but it shows up like this in the editor
I should probably mention the class is being defined in another class which the list is being displayed on
Nevermind ignore me, it can't serialize properties oops 
it can, add [field: SerializeField] behind the properties
can't update unity because i need it to work in 2021.3 and 2022.3. It's a tool, and for compatibility, i can't
Does anyone know how to export asset bundles for older versions(2019.1) ? I've seen many tutorials but none of them worked for me.
was told this was the more appropriate channel-- did anyone know how to access all the possible values of binding.propertyName ? I have a script that copies and modiefies a bunch of keyframes, and I wanted to make sure that I get them all/ modify them appropriately..
all of them have the m_ prefix but i wasnt able to find a list of all of them in the documentation online
edit: i have for now resolved this by having a** default:** keyword in my switch... was impossible to search for everything, ill just bugfix if i ever encounter a binding that needs to be fixed
im sure its a bug that is solvable with the right research. so in the inspector. your trying to add items to an array? in c# we use Lists. they are our arrays. so your trying to add an item to a list from the inspector? so are you dragging and dropping an item into your list?
if you would copy and paste your console error i might be a better help.
i dont often work with logs but i read console errors on a nearly constant basis
if somehow a console error is not being logged but your getting a log. i wouldnt be your guy.l
from this log. what im gathering. is that you are trying to log into a database? maybe even if its unitys own user database. and you are failing at logging in. therefore youre logging in as a guest. some ids are getting assigned. a token is signed. probably a guest token. not a valid user token.
BatchMode: 0, IsHumanControllingUs: 1, StartBugReporterOnCrash: 1, Is64bit: 1, IsPro: 0
this line stands out a bit to me. what are the packages that youre using in your project? most likely the 1s are true and the 0s are false.
is this bug happening in your procedural terrain generator?
I see what you mean but it's far from the truth. From the first answer:
The items are manually created and destroyed from the list via code, the own holder of the lists manages it.
From the second answer:
I do not try to modify, log or enter any database. This is pure unity code unrelated to mine (at least from the logs side) It seems that the issue only happens on the LTS of 2021 and it's nowhere to be found on future versions, so it's probably something patched. I also followed all guidelines and it still was happening, so it's probably a patched unity bug that wasn't patched on older versions. Since there are now more unity versions (unity 6.3, unity 6.0 and 2022) that are considered supported by unity i decided to drop 2021 for now on the support for my asset
Glad you figured it out. Your log mentions handshakes and tokens getting signed which is very common language in reference to databases so i assumed it may have been related to one.
can you share data between custom editor windows?
Sure, they are just C# classes
how can you track if one is open? I want to make a custom timeline for my moveset editor
and can I programmatically open another window from one window?
EditorWindow probably has some generic static method for that
I know there's EditorWindow.Getwindow
I think HasOpenInstances is what you want
I guess ScriptableSingleton can also be useful here?
If it needs to persist
I'll do some more research before I get into it
Remember that you can make custom tracks and playables for timeline
Hey, experienced web developer but beginner with Unity. Ive gone down a crazy rabbit hole of trying to write script to place some Prefab items in a grid.
Thats it, it all started with me messing with a tutorial that had me placing some cubes, then i just thought man its hard to get them equidistant, i would love to place them in a grid programmatically.....
Ive looking into Editor scripts but honestly i dont know if im going down the wrong path here, i just want to right click on a cube and run a custom script in editor mode with some arguments
I'm not trying to use the timeline itself, I just want it's structure to visualise a move
is there some sort of base I can find to get started with?
Well with UITK you can use the visual editor to make editor gui
otherwise not really you just have to produce it using the pre made controls in either system (e.g button, toggle, text box)
but drawing some elements in a long row/column isnt hard
UITK lets you define your own kinds of ui elements
which can be really useful when you're creating a ui for some specific task
how to edit Dictionary in Inspector
Unity can't serialize dictionaries so you'd need to use some third party "serialized dictionary" package instead
(Serialization is needed to show a type in the inspector and for it to be saved)
thats why i posted in extensions
Just try this or something
https://github.com/ayellowpaper/SerializedDictionary
There's a lot of these implementations if you google
hey guys, im trying to install android build support for my unity editor on arch
and i get this error
which tells me nothing
im a bit stuck for what to do, i looked online and people said i might need to have cpio or p7zip, got both and still doesn't work
thinking of doing a manual install
anyone have any tips ?
Try to check the unity hub logs to see if any more information is in there
!logs
Editor logs
Windows: %LOCALAPPDATA%\Unity\Editor\Editor.log
MacOS: ~/Library/Logs/Unity/Editor.log
Linux: ~/.config/unity3d/Editor.log
Unity Hub
Windows: %UserProfile%\AppData\Roaming\UnityHub\logs
Mac: ~/Library/Application support/UnityHub/logs
Linux: ~/.config/UnityHub/logs
yeah i did and there wasn't much more available, thankfully using flatpack version of unity i got it working
the UI looks new , im guessing its the latest version of unity hub ? Personally i try and avoid upgrading the Hub as late as possible due to crap like that. Maybe download older hub version from the archive ?
ooh yes i might try to do that
i got a friend of mine to build the project
is there any way to make a CustomEditor show on a heterogenous multiselection? i have a BaseClass, a bunch of Derived1 : BaseClass, Derived2 : BaseClass, ..., and a CustomEditor(BaseClass), and i'd like to be able to multiselect different DerivedX assets and have the inspector use my custom editor instead of showing "narrow the selection"
Is the [CanEditMultipleObjects] attribute not enough?
unfortunately no, it only seems to work if the selection is homogenous
if i'm selecting different assets (even when derived from the same base class), the inspector forces this kind of view instead of rendering the custom editor defined for the base class, and this is even if i set editorForChildClasses: true on the CustomEditor attribute
whats the expected behaviour here?
What if you pass true to the editorForChildClasses argument of CustomEditor attribute?
Combined with CanEditMultipleObjects
no luck unfortunately
Oh shit sorry just saw you mentioned it already 😅
what i'd like is for the inspector to render the CustomEditor(BaseClass) with multiple targets, and then i could show the shared stuff from the base class using the base class editor
i could be tripping but im now realising i don't think unity would/does handle that
i can of course make my own editor window for this, but it would be nice to have this integrated into the inspector
like if you normally multi select a mix of deriving inspectors it doesn't assumadly downcast right? with no custom editors involved
yea it has the same behavior regardless of whether there's a customeditor or not
what i basically just want is to bypass the "narrow the selection" thing in this case, but i guess there's no api for that
I would expect it to draw the fields that the classes have common from their base class but nope
i guess that makes sense tbh, i can think of some weird edge cases
Hey, I got this script, rebound it to include shift by adding # to the bind, and it sadly only works via ui, not via bind.
Would somebody happen to know why?
https://gist.github.com/adammyhre/705c0eb2bc83de7c1b8639fb6a79305d
Ok, it actually seems that copying works via bind, but pasting doesn't.
Why?
@hearty shuttle Don't cross-post, your question is still visible where you posted it. If you want to post more complete question, update it.
My bad forgot to delete.
Has anybody had success using an IMGUIContainer to wrap a LocalizedStringPropertyDrawer? I'm trying to convert our editor tools UI to UIToolkit, and where Unity hasn't converted their drawers it seems like we have to use IMGUIContainers.
The problem I'm encountering is: editing a LocalizedString's local variables doesn't work when the drawer is embedded in an IMGUIContainer. I can add new local variables, but modifying or removing them in the UI does nothing. Not sure if the LocalizedStringPropertyDrawer isn't properly bound to the LocalizedString, or what.
We have an "aggregate" property drawer; basically just a drawer that embeds the native drawer for a property, and additional drawers for debugging info.
This previously used IMGUI:
{
AcquireChildDrawers();
int drawerIndex = 0;
foreach (PropertyDrawer childDrawer in m_childDrawerList)
{
Rect childRect = position;
label = drawerIndex == 0 ? label : GUIContent.none;
childRect.height = childDrawer.GetPropertyHeight(property, label);
childDrawer.OnGUI(childRect, property, label);
position.y += childRect.height;
position.height -= childRect.height;
++drawerIndex;
}
}```
converting it to UIToolkit...
{
Box container = new()
{
style =
{
flexDirection = FlexDirection.Column,
},
};
container.TrackPropertyValue(property);
container.TrackSerializedObjectValue(property.serializedObject);
AcquireChildDrawers();
int drawerIndex = 0;
foreach (PropertyDrawer childDrawer in m_childDrawerList)
{
// Prefer UIToolkit API for child elements, falling back to IMGUI when a child doesn't implement UIToolkit
VisualElement? childElement = childDrawer.CreatePropertyGUI(property);
if (childElement != null)
{
container.Add(childElement);
}
else
{
int index = drawerIndex;
IMGUIContainer imguiContainer = new()
{
};
imguiContainer.TrackPropertyValue(property);
imguiContainer.TrackSerializedObjectValue(property.serializedObject);
imguiContainer.onGUIHandler = () =>
{
GUIContent label = index == 0 ? new GUIContent(property.displayName) : GUIContent.none;
imguiContainer.style.minHeight = childDrawer.GetPropertyHeight(property, label);
Rect layout = imguiContainer.contentRect;
childDrawer.OnGUI(layout, property, label);
};
container.Add(imguiContainer);
}
++drawerIndex;
}
return container;
}```
If anybody else cares, turns out I needed to call property.serializedObject.ApplyModifiedProperties(); at the end of the onGUIHandler
ah, that'll do it :p
In package manifest manual and creating samples for pakcages manual I see conflicting information. In a former one it shows to include samples like "path": "Samples~/<sample-subfolder>", while the later one states Don’t append a trailing tilde (~). During the export process, Unity will rename the Samples folder to Samples~ automatically. This inconsistency makes me question the manual, so can anyone confirm that automatic tilde thing?
Two in editor scripts to help with building!
How to install:
- Make an empty parent in your scene called "Services"
- Drag each script into the empty parent's components list.
- To disable just deactivate the scripts.
Information:
Both scripts have their own editable parameters inside the components list. To use the script once installed click any GameObject in your world and make sure view tool is selected to make it easier to grab the resize knobs/ place gapfill points.
Enjoy!
Generally people prefer editor tools that are actual editor tools and not components in scene
Yes it should be an editor window and not use a monobehaviour
Yea, thats why ive been making a grid guide system in UGUI for designing.
Becuz unity doesn't provide a proper grid system that will allow the user to make correct adjustment in ui.
(Similar tools uses monobehaviour)
What is the "export process" the latter source is talking about?
ah yeah, that's if you're using the "Export" button in the package manager
If you're using that workflow, then just name the folder "Samples"
If you're not using that workflow, you need to name the folder "Samples~"
Oh so thats the difference, OK then, thanks for clarification!
It solves a bit of a headache: the point of naming it Samples~ is that Unity won't try to import anything inside the folder
however, since it won't be imported, you can't edit its contents while you're developing the package!
you can copy Assets/Samples over to Packages/com.coolpackage/Samples~ (that's what I do), but now you have two copies of everything in the project
Yeah I've been there as well last time I was making a package, didn't know about that automation then
how do i get my editor window floatField to have the click, drag to edit value functionalities? I saw some stuff about adding it in USS in chat history, or maybe changing it to a property field -- I wasn't able to get either to work but I'm also not really sure what I am doing
I also made my editor window without UI toolkit, so I don't know if that's bad either -- I thought that was a seperate thing that you could work with later on after you get the functionalities of the script done 😭
hey so i just started a new project the other day, and for some reason my project settings arent saving. i noticed whenever i reopened the project my input system settings' actions are back at the default. sorry if this is the wrong channel
Sometimes you need to do File > Save project to make unity write some changes to disk now
Then they can be commited to source control (if thats how they are getting lost)
is there a way to make a PropertyAttribute and custompropertydrawer in order to get a list/array to render "inline" in the inspector, meaning: no foldout, -1 indent level?
if i just create an attribute and apply it to a list field, it applies to the elements of the list and not the list itself
Newer versions of unity allow you to target the list itself with the property drawer
see the "useForChildren" parameter
This was first introduced in 2023.1, so the last major version without support is 2022.3
annoyingly, this is the version that VRChat uses
I worked around this by creating a new DecoratedList class that wraps a list.
vr chat moment
ahh thanks! thankfully i'm on a recent version
having to maintain years and years of user-generated content sounds terrifying
Yea it probably means they will be on birp forever
absolutely
so i guess some 6 version is their upper limit for an upgrade
there is no god-damn way they're migrating off of BiRP for PC avatars
Quest avatars, at least, don't permit custom shaders
so they can just migrate
many PC shaders rely on GrabPass, notably, and I have no clue how they'd recreate that correctly
nevermind trying to migrate over a massive pile of compiled shaders
(they might upload the original shaders as well, at least)
Id deem that near impossible without some crazy work so I think it just wont happen ever
i heard they tried to move to SPS-I (single-pass-shading, instanced)
but that didn't pan out
that only requires a bit of extra work to support in your shaders, but it was still too much
VRC uses double-wide rendering, which was nominally removed from 2022.3
Ah that is a big problem 😐
they modify the shader compiler in some arcane way to bring back support for it
if this modification fails, you get some hilarious problems
your left eye is fine, but your right eye sees..
it's like you're seeing the left eye again, but it's all distorted
it did not work unfortunately, what else should i try?
Input system actions are stored in an asset and it shows in project settings if one is assigned there as project wide. You can try with a new input actions asset?
library\PackageCache\com.unity.render-pipelines.universal@e9f15c489688\Editor\Tools\Converters\ReadonlyMaterialConverter\ReadonlyMaterialConverter.cs(159,18): error CS0246: The type or namespace name 'MaterialReferenceChanger' could not be found (are you missing a using directive or an assembly reference?)
is this issue fixed? i checked many times no problem on my code.
Unity/URP package bug or broken package content issue
downgrade URP package or something?
if all of your packages are up to date (check the Package Manager), this could be a case of a corrupted package cache
the global package cache, that is
if that is the cause, the fix would be:
- Close Unity
- Delete the Library folder from the project (this will force Unity to reinstall packages)
- Delete the global cache folder, as described in that link (this will force Unity to re-download the packages)
i have seen this error more than once, which seems odd for something caused by completely random corruption
did you do all of those things just now?
can't fonish my tooling 95% done
yeah reinstalled got rid of c drive and all that fresh new project makes that issue
"got rid of c drive" ...?
temp files that unity makes
6.3 lts latest
creating empty project makes that issue you know there's nothing inside just an urp template of a new project but it still gets like error you know
yeap 😄
can you check the exact package versions you have in the Package Manager?
well its opening will check soon
Yeah this issue has been reported by several users I don't know if it's fixed or not maybe I should try to use unity 6.4 but I started making the project using 6.3 not sure it's gonna work on 6.4 or not
i see a handful of people talking about this
which is more than I'd expect for random cache corruption
I think it has been caused by some recently unity update or something and I cannot finish my product right now that I was supposed to make for my client
Yes most likely I'm gonna miss this client I have to look for another client you know
going to try installing unity 6.4
try navigating to this path, starting from the project root:
- Library
- PackageCache
- com.unity.render-pipelines.universal@XXXXXXXXXXXX (the exact suffix depends on your package version)
- Editor
- Tools
- Converters
- ReadonlyMaterialConverter
Does this folder contain a file named ReadonlyMaterialConverter.MaterialReferenceChanger.cs?
yea i have to delete this particular file to run unity atm
ReadonlyMaterialConverter.MaterialReferenceChanger.cs
after that it runs
it keep reappering after every new run btw
i hope unity fixes this issue
...you're going to need to elaborate on that
are you deleting that file from your package cache?
i am deleting in th eproject i make
that's obviously going to cause a compile error, because you deleted a source file
this is some very important context you've left out
and finished doing that steps u said before
if i keep this file i cannot press play: ReadonlyMaterialConverter.MaterialReferenceChanger.cs?
anyways its problem on unity end hopefully it gets fixed
i have no issues on my laptop
[CompilerError] The type or namespace name 'MaterialReferenceChanger' could not be found (are you missing a using directive or an assembly reference?)
Compiler Error at Library\PackageCache\com.unity.render-pipelines.universal@e9f15c489688\Editor\Tools\Converters\ReadonlyMaterialConverter\ReadonlyMaterialConverter.cs:159 column 18
its a compilor error
That error is caused by deleting that file
Don't do that
You are deleting the file that defines what a MaterialReferenceChanger is
unity cannot complile currentyl fresh new projects start with that error
where did you delete that file from?
It's from newly fresh project
when i made another project but it s....it's a compiler error from unity When I made another project but it starts with that error anyways basically it's a compiler error from unity side
it has issues compiling urp package so most likely the package manager issue happening after updates
I have no idea what you've done to your package cache at this point
I can't imagine how deleting the MaterialReferenceChanger script would fix a compile error about MaterialReferenceChanger not existing
Thanks for your help trying to help me out uh I will see what I can I was hoping I could get some advice from here the experts you know
i fixed it
but took 2 hours today and 2 more days on debuggin to seei f anything wrong on my end 😐
Hello ! Im working on an editor tool and I want to interview some devs to see if people generally think the things offered in it seem useful / valuable in a workflow .
Not trying to advertise or sell anything, I just want to get feedback on if this package actually seems like something that could be valuable for people, or if it's something you think people might use once and not pick up again.
Shoot me a DM !
Hi ! Did anyone try out the new MainToolbarElement stuff from Unity 6.3 ? If someone did, is there something like a separator ? Didn't find anything in the documentation but there might be some secret knowledge 👀
private void ReplaceColors()
{
Debug.Log(ColorReplacementPairs.Count);
if (ColorReplacementPairs.Count == 0) return;
var text = TextureObjectField.value as Texture2D;
newTexture = new Texture2D(text.width, text.height, text.format, false);
Graphics.CopyTexture(text, newTexture);
var colors = newTexture.GetPixels();
for (var index = 0; index < colors.Length; index++)
{
var col = colors[index];
foreach (var cPP in ColorReplacementPairs)
{
if (col == cPP.ColorToReplace)
{
colors[index] = cPP.ReplacementColor;
Debug.Log("COLOR HAS BEEN REPLACED!");
}
}
}
Debug.Log("color amount: " + colors.Length);
newTexture.SetPixels(colors);
newTexture.Apply();
NewImage.style.backgroundImage = newTexture;
}
I have this editor window that I'm trying to make where it replaces colours, but it doesnt seem to be actually applying the new colors. Am i doing this wrong? the debug log is firing
Is this meant to modify a texture asset or just a texture in memory?
what is TextureObjectField ?
Are you sure that Graphics.CopyTexture is doing what you want here?
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Graphics.CopyTexture.html
This method copies pixel data from one texture to another on the GPU. If Texture.isReadable is true for both src and dst, the method also attempts to copy pixel data on the CPU by running a CopyPixels method such as Texture2D.CopyPixels. If Texture.isReadable is false for either src or dst, or they are provided as type GraphicsTexture, no pixel data will be copied on the CPU and CopyTexture becomes one of the fastest ways to copy a texture. Warning: Be careful when using an Apply method such as Texture2D.Apply after CopyTexture, because you might copy old or undefined CPU texture data to the GPU.
its this
im trying to modify a copy of this texture, and save it to disk
Then the above mention may be relevant but you also need to save the texture to disk if you want this to modify the file
All you did is modify it in memory and thats it
i've tried saving it to disk, and it looks like no changes have been made
its meant to show the changes here, where modified uses the modified texture
You should be able to just load the texture asset, modify it (if readable, otherwise use CopyPixels() in a new texture) then encode and override the asset.
https://docs.unity3d.com/6000.3/Documentation/ScriptReference/ImageConversion.EncodeToPNG.html
Have you tried using a debugger to verify your colour matches work instead of debug logs?
how would i do this?
Attach a debugger, run the texture update, verify logic acts as you desire such as matches a colour and replaces it at somepoint.
vs code, vs and rider work
i got it working! turns out the image needs to be non compressed, and have read/write enabled. it works after that!
I remember there being a trick to modify any texture. May be that you can copy any to a new read/write texture
I have this colour field, and I want something to happen when the value changes. it does do this, but it also does it as I'm dragging around the little indicator. is there a way for it to only do it when you let go of the slider?
is this UIToolkit or IMGUI?
(All of that was said in the doc I linked/quoted)
I assume that Apply was just overwriting everything that CopyTexture had done on the GPU
toolkit
I'm not aware of a way to do this -- there isn't a "commit" event.
I bet you could subclass ColorField to add support for that, though
i have my own managed reference instancer attribute drawer that we use, but for some reason when i have a list on a scriptable object thats using the attribute and i edit the list before a domain reload occurs. all the instanced references breaks. im kinda confused of why this happens. is it something with i have to just save before doing anything if not it wont store the references? it also only happens on the object that is drawn in the inspector while its reloading so maybe its someting with its being used while its reloading and it breaks?
Or could it be related to that i was editing the script which was being used in the managed reference and since it had its property drawer rendered it somehow messed with the reference?
figured this out-- its enabled by default. if you are creating labels for your floatfields/ etc thats unecessary! turns out the documentation had the parameters in a different order....
it goes like this: FloatField("label", variable); and hovering the new label will give you that drag to edit value/ slide.
Is there way to set some extensions as default? Gets annoying to import all extensions, when starting project
Can we drag & drop something from our own editor window into the scene? Kind of like you would drag a prefab in from the Project view.
if "something" is a gameobject, then you can implement that by putting the thing under the drag-start into a variable and then tracking the cursor in the scene view, instantiating it when its over the scene view, and then dropping it when it is where you want. part that is explained here: https://docs.unity3d.com/6000.3/Documentation/Manual/UIE-drag-across-windows.html
Cheers I'll check it
I'm trying to Change the inspector based on if the Event Type is set to Dialog or Move
but the Editor isn't doing anything
So I tested by making the Event Class a MonoBehaviour and It worked,
it was changed
but I don't want the Event Class to be a MonoBehaviour because then I can't use it in the Array like I am
Is there a way I could Change the inspector like this?
Or should I have the Editor interact with the Event Trigger script instead of the Event one?
if so how'd I go about doing that?
Hello! Is there a way for Rider to communicate with unity's localization table?
Custom editor classes only work with unity objects, if you want to create custom displays for certain custom types you need to use a property drawer.
Also I reccomend using UI Toolkit for your editors
a Custom Editor draws the entire inspector; a Property Drawer renders a single property!
in Graph Toolkit, one can dynamically add ports depending on value of an option easily. I somehow tried to execute the same on a Context Node where an Output Port becomes visible when there are no Block Nodes in it. The picture shows the behavior perfectly, however, changing stuff on the graph, like adding a Block Node to the middle one on the photo below doesn't remove the Output Port automatically.
class DialogueNode : ContextNode
{
protected override void OnDefinePorts(IPortDefinitionContext context)
{
context.AddInputPort("Input").WithConnectorUI(PortConnectorUI.Arrowhead).Build();
if (this.BlockCount == 0) {
context.AddOutputPort("Output").WithConnectorUI(PortConnectorUI.Arrowhead).Build();
}
}
}
Am I lacking something or completely doing this wrong?
-# (example of what i didnt want to happen: context node's output stays available despite having a block node.)
nvm, i encountered more bugs like floating wire ends when doing what I wanted 
i should preface this by saying that i've literally never used this system, but doesn't OnDefinePorts get run once, when the node gets created?
yes, but it also gets fired every time OnGraphChanged is triggered
at least in my setup
but yeah, completely ditched the idea of what i mentioned above
!ide
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
bruh i thought it was to configure what editor you use 😭
now there's just the ide command in a serious and thoughtful conversation
hey i couldn't really find a unity specific doc that explain how perlin noise works in rule tile the pattern is too not random
also how can implement this i made a rule tile for my room but i don't know how to implement a little passage for each room
Is there any way to write code/tools that interface with the unity animator? I have tools and fixes I want to extend/fix/change its functionality to help automate some animation tasks
but most of what ive googled says Animator keyframes are untouchable
For example, I'd like to write a script that offsets all selected keyframes forward X frames, and then wrap/loops the stuff that went past the 'length' of the animation back around to the start, offset the whole animation's frame time
I can do the logic of that, but to do that I need some way to 'get' and 'edit' what keyframes are selected in Animator
For editing the keyframes, you have to use AnimationUtility to read the existing curves in a clip
I am not sure about detecting which keyframes are selected.
You can get an AnimationWindow instance, but it only tells you a few things, like where the playhead is
The actual editing happens in AnimEdtior, and that's internal, so you'd need reflection to peek into it
Trying to install graph toolkit on unity 6.4 but "install package by technical name (com.unity.graphtoolkit)" results in "Unable to find the package with the specified name. Please check the name and try again.". Am i missing something here?
It's a built in module since 6.4
which means what? I don't need to install it?
coz it doesn't show anywhere in the package manager
well i'll be damned... the assembly is there already. That's so misleading.
how do i set icon for graph toolkit asset? do i have to use ScriptedImporter? i was hoping there is built in way to set icon
Is there a way to override the skinnedmeshrenderer editor?
Anyone know about GraphView? I'm trying to make right click pan the graph, cus I hate middle-click lol
But I can't get it working as context menu seems to completely consume right click, nothing else works under right click. Is there a way around this?
yeah just create a new editor class for the skinned mesh renderer
Why not just change the shortcuts?
as v0lt said you can find shortcut its called 2D Pan
@vast isle @surreal delta
There are no changeable shortcuts for this? 2D Pan is only for scene view and is already assigned to right mouse
Also I've got more important issues now, I can't seem to override any of unity's controls. I want to not be able to delete the first node, however unity deletes it anyway.
Want to shift+click to add nodes to selection, but clicking another node single-selects it no matter what
Either graph view is not too flexible or i just can't figure out how to fully customize it
wait i mistaken graph toolkit with graph view you mean the UIElements one right?
have you tried RegisterCallbacksOnTarget with PointerDownEvent and PointerMoveEvent?
Awesome, got it working perfectly with this tip! 🙂
Thanks
did you ever figure this out?
using scriptedImporter works but its kinda of over kill to use it just to set an icon ,
so im waiting until unity add an easy way to set an icon ,
what does unit call this radio button style?
Those look like tabs honestly but the buttons alone could use ToggleButtonGroup (using the UI Toolkit, don’t know if uGUI has similar) if you don’t need the tabbing behavior
I am trying to make something like this. This is what I can do, but I really wanted unity's because just look how beautiful and clean their version was compared to mine
^ am curious as well
Is this with ToggleButtonGroup?
@cyan karma @opal burrow @clear kite That is a ToggleButtonGroup. But I highly recommend using Tab instead since it is made for it and follows the editor design guidelines.
im not using ui toolkit 😔 thought it was a thing that i could add on later to refine my ui, but couldnt figure out how to move my existing editor window script to it.
though, i didnt investigate too much since it wasnt pressing
I'm trying to make a custom editor for my characters in-game diary/schedule, this is my first time doing custom editor stuff. Every time I close/open unity every schedule I've created with my custom editor seems to have vanished. For some reason, no changes I make to the list of schedules I create seems to be being saved?
The first screenshot shows the function in my custom editor script which calls to my my NPC info script
second screenshot shows the called function in the NPCInfo script (SerializedObject). "schedulesChapter" is a List of DefaultSchedules
third screenshot shows the layout of the DefaultSchedule (Struct)
forth is my custom editor with an empty timeline on launch
sorry if this is a bit convoluted, I just can't get any changes I make to the list to save through sessions, and I don't know why?
are you marking the scriptable object as dirty?
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/EditorUtility.SetDirty.html
also no need to crosspost
literally just figured this out on my own after looking at this for days, thank you 😭
this seems to have done it
if i have a ScriptableObject that needs some additional import processing, what's the most efficient way to do that that would also be triggered if the code of the ScriptableObject changes?
i'm able to do the additional processing in OnPostProcessAllAssets successfully but it doesn't trigger if i modify the code of the scriptable object (for example to add a new serialized field)
i guess i just have to go through them all if didDomainReload=true?
I'm learning unity editor stuff for a rhythm game project I'm working on at the moment to try and build developer tools for mapping. I've been looking around for any resources that would point me to being able to recreate unity's native audio visualization (like is done in timeline) and can't find anything. Can someone point me in the right direction for documentation?
You can see in the Timeline source code in your project that AudioPlayableAssetEditor has a CreateWaveformPreview function which just calls into the internal class WaveformPreviewFactory to create a StreamedAudioClipPreview, which contains most of the logic.
AddSchedule is directly modifying the C# object. Any changes are prone to being lost.
Use Undo.RecordObject to track changes to the object
(SetDirty does also work; I believe that tells Unity to check if the corresponding C# object got modified)
You can also use the SerializedObject/SerializedProperty system to add the schedule item
this is generally more tedious, though
I did try adding undo.recordobject but I couldn't get it to do anything when I implemented it (as in it wouldn't appear in the undo/redo menu) c: I may have just done something wrong tho?
what object did you record?
just (target) i believe
you could add a custom dependency on the MonoScript asset
specifically, you need to depend on the actual source file
Hi all. Is it possible to rever the name of... a prefab in a prefab hierarchy?
In this case, it's this "Zone house" name. It's clearly bolded, but right clicking anywhere doesn't show the revert option. Going to debug mode also doesn't reveal anything relevant
You would need to use PrefabUtility to find the prefab asset and change the name back
But is that technically "reverting" ?
Also, i call FindObjectsByType from an inspector button, in prefab mode. This gives these errors and the only Zone instance i'm trying to get it to cache (inside the hierarchy of the prefab itself) doesn't get added
I think gameobject name is excluded as that would rename the prefab asset if you could apply it
If gameobject name is that important then your prefab + main component on it needs refactoring to use some other id
Try using PrefabStage and get components in children instead:
https://docs.unity3d.com/6000.4/Documentation/ScriptReference/SceneManagement.StageUtility.GetCurrentStage.html
https://docs.unity3d.com/6000.4/Documentation/ScriptReference/SceneManagement.PrefabStage-prefabContentsRoot.html
I have an array of strings being represented by a propertyfield in unity's custom editor, does anyone know how to registercallbacks for it? I assume you'd need multiple different ones for adding/subtracting a list, and making changes to one?
bump c:?
Use the RegisterValueChangedCallback function
I am working on some handles. I'm having an issue where changing the length of the box causes jittering.
I presume this is because changing the length also changes where the center of the box is.
var bakedSpotBox = target as BakedSpotBox;
Handles.matrix = bakedSpotBox.transform.localToWorldMatrix;
Vector3 center = Vector3.forward * bakedSpotBox.baseLight.range / 2;
EditorGUI.BeginChangeCheck();
Handles.color = Color.red;
Vector3 newWidthPosition = Handles.Slider(Vector3.right * bakedSpotBox.width / 2 + center, Vector3.right, 1f, Handles.RectangleHandleCap, 0f);
Handles.color = Color.green;
Vector3 newHeightPosition = Handles.Slider(Vector3.up * bakedSpotBox.height / 2 + center, Vector3.up, 1f, Handles.RectangleHandleCap, 0f);
Handles.color = Color.blue;
Vector3 newRangePosition = Handles.Slider(Vector3.forward * bakedSpotBox.baseLight.range / 2 + center, Vector3.forward, 1f, Handles.RectangleHandleCap, 0f);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Adjust Baked Spot Box");
bakedSpotBox.width = newWidthPosition.x * 2;
bakedSpotBox.height = newHeightPosition.y * 2;
Undo.RecordObject(bakedSpotBox.baseLight, "Adjust Light");
bakedSpotBox.baseLight.range = (newRangePosition.z - center.z) * 2;
}
center = Vector3.forward * bakedSpotBox.baseLight.range / 2;
Handles.color = Color.white;
Handles.DrawWireCube(center, new Vector3(bakedSpotBox.width, bakedSpotBox.height, bakedSpotBox.baseLight.range));
I understand that OnSceneGUI gets called multiple times per frame (since there are different event types, like "layout" and "repaint")
i feel like i'm incorrectly running the handles code when I shouldn't be
https://docs.unity3d.com/6000.4/Documentation/ScriptReference/Handles.Slider.html
however, I don't see any special handling going on here
notably, if i move my mouse very slowly, i can make it flicker between a valid-looking result and an incorrect one
Ah, yeah, it was just an error in my logic
I needed to recalculate the center position before trying to subtract it from the current slider position
I've noticed that my handles do not change color when I mouse over them
I'm having trouble figuring out how you actually do that
I've worked out that I can write a method that adjusts the color and then calls an existing handle function
internal static void RectangleHandleCap(
int controlID,
Vector3 position,
Quaternion rotation,
float size,
UnityEngine.EventType eventType)
{
if (eventType == EventType.Repaint)
{
if (HandleUtility.nearestControl == controlID)
{
Handles.color = Color.white;
}
}
Handles.RectangleHandleCap(controlID, position, rotation, size, eventType);
}
e.g.
relatedly, this has made it a lot more clear how IMGUI works
the point is that you run the code multiple times (at least once to layout and once to paint)
as long as you consistently call the same functions in the same order, everything winds up with consistent IDs during each phase
Hi,
I've got a question:
Since it's not possible to dynamically add or remove entries to a submenu of a [MenuItem], I was trying to use the GenericMenu and calling either ShowAsContext or DropDown on it.
Unfortunately, neither works as I'd like to:
- ShowAsContext relies on Event.current to retrieve teh mouse position.
-DropDown needs a rectangle to display the drop down menu.
For the latter, I have to get the mouse position myself, but I fail to do it in a convenient way which wouldn't rely on thinks like:
#if UNITY_EDITOR_WIN
if (GetCursorPos(out var point))
{
var pixelRect = new Rect(point.x, point.y, 1, 1);
return EditorGUIUtility.PixelsToPoints(pixelRect);
}
#ENDIF
And even then, while the x screen position is correct, the y position is offset.
Has anyone achieved to do what I want? If yes, how?
You can make a MenuItem validation function and it will disable/enable said item based on your conditions
Context why I need this: My tool allows opening the same window multiple times. In each window, you can select another schema to work with. On Mac, those windows might drop behind the actual Unity editor. I want to display a list of opened tool windows, so that the user can quickly switch to/bring to front the tool window he needs.
Unfortunatly, Unity does not allow this. So, I wanted to display a Context window or drop down list when the user clicks onto the "Show opened tool windows" menu point of my tool.
I think you are better off with a dropdown, you can customize the unity toolbar and add a dropdown of previously opened windows which you can dynamically change
The drop down is what I'm resolving to. I want to open it when I click onto this menu point. And that's where the mouse position enters the arena...
Why not add it to the toolbar?
That would add a single button for 1 purpose for 1 tool... imagine all tools would do that
Thats perfectly fine, that dropdown can be enabled/disabled and moved around by the user, look at unity's dropdowns, there is one for quality levels, thats 1 button for 1 purpose
hello, in ui toolkit, how to make an embedded list example like the left image?
You mean like removing the collection foldouts?
Yes, the main purpose i would like to make a character team spawn editor extension function, but now I can't find a UI toolkit option similar to that
You just have to override the editor and instead of rendering the list you render a custom UI with the data in the list
I'll take a look at it. Thanks for pointing me to this.
Is that one use IMGUI? But right now i not plan to use the component to do the character spawn, I plan to save the character data to the JSON. I want to place the character spawn info at the map😶🌫️
Same like rpgmaker
Alternatively, perhaps a UI toolkit feature is needed that allows for unlimited addition and removal of objects
Never mind i guess i have a solution, thank you
Thanks... works like a charm. Only supported from 6.3 onwards.
What options do I have (even if paid) that is called not Odin to serialize an Interface to the inspector? Meaning I only want objects that implement a specific interface.
Serialise as component or monobehaviour and validate via OnValidate or custom drawer
It's what I do anyway
I've used https://github.com/Thundernerd/Unity3D-SerializableInterface before
it can handle both Unity Object references and other classes
Sounds about right, serialize as something else and cast at runtime/on load
_Sorry, this is a repeat of my message in #💻┃code-beginner _
Hi guys! I'm really stuck with something. I think I'm missing something super simple, but I just can't seem to figure out what it is.
I'm currently working on customizing my inspector a bit, using VisualElements in a PropertyDrawer. Essentially, you have different QuestTypes, and depending on the QuestType I want to show different fields in the inspector.
I'm Adding the right children to the root, and it does work with the initial QuestType picked, but when I change QuestType in the inspector, no children get displayed even though my RegisterValueChangeCallback((changeEvent) => CheckForType()); gets called.
Again, it should be something so simple, yet I can't seem to figure out what I'm doing wrong. Anyone here have any experience with VisualElements?
public override VisualElement CreatePropertyGUI(SerializedProperty property)
{
objectiveType = property.FindPropertyRelative("type");
PropertyField type = new(objectiveType);
type.RegisterValueChangeCallback((changeEvent) => CheckForType());
questObjectiveDetails = new PropertyField();
VisualElement root = new();
root.Add(type);
root.Add(questObjectiveDetails);
return root;
}
private void CheckForType()
{
QuestObjectiveType enumType = (QuestObjectiveType)objectiveType.enumValueIndex;
questObjectiveDetails.Clear();
switch (enumType)
{
case QuestObjectiveType.Collect:
{
questObjectiveDetails.Add(new PropertyField(property.FindPropertyRelative("itemData")));
questObjectiveDetails.Add(new PropertyField(property.FindPropertyRelative("gatherAmount")));
break;
}
case QuestObjectiveType.Interact:
{
questObjectiveDetails.Add(new PropertyField(property.FindPropertyRelative("interactable")));
break;
}
}
}
is essentially what I currently have.
I've tried searching around but I cannot find anything, is there a way for me to add new elements to the play mode bar?
Not sure but caching collectGroup and interactableGroup looks a bit suspicious, try just recreating it when objectiveType changes
I changed it, but doesn't seem to work either 🙃 I really appreciate the help though xx
It's like the Add isn't adding?? The Clear() works just fine.
Uhhhh I very vaguely recall running into this at some point
Try keeping track of the instance and doing Remove instead, or use https://docs.unity3d.com/6000.4/Documentation/ScriptReference/EditorApplication-delayCall.html to delay the adding
Don't cross-post, please. Also this is not related to #↕️┃editor-extensions
This belongs in #🖼️┃2d-tools .
Also you need to click on the edit mode if you are editing tile palette.
Oh, okay
Thanks
i'm curious about the actual implications of this error getting spat out
One instance gets logged for each place that my prefab instance overrides a [SerializeReference] field.
The thing is that...it works fine?
notably: if I fully unpack the prefab, the resulting object has completely valid managed reference data
SSource<T> is derived from SerializableInterface<ISourceOf<T>>; it's just there to cut down on line length. SerializeableInterface works by storing a object with [SerializeReference]
Note that this is in 2022.3
I try to avoid overrides like this anyway (because they'll fall apart the moment I edit the parent prefab), so it isn't a very common situation
(so, more pedantically: each place where it overrides a field that, itself, contains a [SerializeReference] field)
is there any way to track/trigger something when there's changes made within a class like this? the action I've set up tracks when I add/remove elements from the array but I can't seem to figure out how to get the script to recognise when I make a change to the "summaryy" or the "inkfilee". basically I want to set a callback for this which then applies the changes to the string or TextAsset to something else. thanks c:
In edit mode you can abuse OnValidate() for monobehaviours.
Otherwise try to use unitys visitor functionality or require use of a setter at runtime.
https://docs.unity3d.com/6000.3/Documentation/Manual/properties-intro.html
I'll check this out. thanks for the lead c:
Is an Infinite Loop in the OnBeforeSerialize() normal when the editor window is open?
Only happens when I have the window with the actual property open
https://docs.unity3d.com/Manual/script-serialization-custom-serialization.html
I'm not really sure if I understand example: Directly serializing a Dictionary
I did exactly that, but I get 2 problems.
One, if I dont use MonoBehavior it works kinda but I get an infinite loop in the OnBeforeSerialize(). Making it very hard to set values.
Second, if I use MonoBehavior all i get in the inspector is a reference field
My Code:
using System.Collections.Generic;
using UnityEngine;
namespace UI.Converters {
public class StringIntDictionary : MonoBehaviour, ISerializationCallbackReceiver {
public Dictionary<string, int> MyDictionary = new();
public List<string> Keys = new() { "ExampleKey" };
public List<int> Values = new() { 42 };
public void OnBeforeSerialize() {
Debug.Log("Serializing StringIntDictionary...");
if (MyDictionary != null) {
Keys.Clear();
Values.Clear();
foreach (var kvp in MyDictionary) {
Keys.Add(kvp.Key);
Values.Add(kvp.Value);
}
}
}
public void OnAfterDeserialize() {
Debug.Log("Deserializing StringIntDictionary...");
MyDictionary = new Dictionary<string, int>();
for (var i = 0; i != Mathf.Min(Keys.Count, Values.Count); i++) {
MyDictionary.Add(Keys[i], Values[i]);
}
}
}
}
And the Scriptable Object:
using System.Collections.Generic;
using UI.Converters;
using UnityEngine;
namespace _tmp {
[CreateAssetMenu(fileName = "RanklistData", menuName = "Scriptable Objects/RanklistData")]
public class RanklistData : ScriptableObject {
[SerializeField]
public StringIntDictionary PlayerScores;
public List<int> TestNumbers = new();
}
}
Did you mean to make the dictionary type MonoBehaviour? Seems wrong if used with a SO
Yeah exactly. I guess thats why I get the reference field? I'm not very experienced, trying that all out for learning purpose. Just did what the example shows.
The thing is, when I remove MonoBehavior it works but the OnBeforeSerialize() gets called multiple times per second, no matter what I changed.
That would imply the asset is being made dirty somehow and is getting saved to disk a lot.
It should not be a Monobehaviour so the class data is serialised inside the asset
Ohh I guess the problem is I try to make a type with that example when I actually should use it in an actual gameobject? I guess I'm just confused why the example uses MonoBehavior
I'll be real it's a shit example don't do it
You want a serialisable class
[Serialisable]
public class DictionaryClass : ISerializationCallbackReceiver {
Okay I will do it this way thanks. Still have to figure out how to check what makes the asset being dirty. Maybe I should just look at a different example in general
Yea a better one would be good but try with the change I suggested firstly
thats basically what im getting
Custom inspector? Btw Odin has serialised dictionary support if you use their base types for assets/monos
I use Odin but only sometimes so far use their attributes.
Oh yea I saw that! I honestly do this right now just to learn serialization in unity haha
Put your inspector into debug mode, does this issue stop?
oh cool i didnt know the debug mode. But no its still infinitely looping
Unity calls OnBeforeSerialize on everything that needs to be drawn in the inspector, each frame repaint from my observation
It seems a bit weird, maybe it's just a quirk of the unity serialization system... I only noticed it by accident when I put a log in the method
Aha makes sense based on that stack
That would explain it if its the standard. The example given in the docu doesn't work for me because of that. cause at each frame it deletes the field values
You can just clear the dictionary instead of making a new instance and try to detect changes to suppress too many updates
Yea I will just add a flag probably. Thanks very much
Seems like either the doc example has faulty logic or there's a bug with OnBeforeSerialize getting spam called from the inspector repaint
With OnAfterDeserialize never getting called
And the doc has been the same since Unity 5.5, apart from some comment changes...
https://docs.unity3d.com/550/Documentation/ScriptReference/ISerializationCallbackReceiver.html
I'm starting to lean towards the inspector serialization bug
Steps to reproduce: 1. Open attached project2. Create any game object3. Attach 'TestCode.cs' script to it4. Select the game object i...
apparently its by design
I guess the example in the doc just isn't supposed to be modified manually in the inspector
I wonder how odin solves this 😉
I do it like this @blazing ember
[Serializable]
public class Map<TKey, TValue> : ISerializationCallbackReceiver, // Other dictionary interfaces
{
[DataTable]
[SerializeField] private List<Pair<TKey, TValue>> backingField = new();
private Dictionary<TKey, TValue> dictionary = new();
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
dictionary = new Dictionary<TKey, TValue>(backingField.Count);
foreach (var pair in backingField)
dictionary[pair.Key] = pair.Value;
}
void ISerializationCallbackReceiver.OnAfterDeserialize() { }
public void Add(TKey key, TValue value)
{
dictionary.Add(key, value);
ReinitializeList();
}
public bool Remove(TKey key)
{
if (dictionary.Remove(key))
{
ReinitializeList();
return true;
}
return false;
}
public void Clear()
{
dictionary.Clear();
ReinitializeList();
}
private void ReinitializeList()
{
backingField.Clear();
foreach (var keyValuePair in dictionary)
backingField.Add(new Pair<TKey, TValue>(keyValuePair.Key, keyValuePair.Value));
}
}
is this about serialized dictionaries because i will once again shoutout ayellowpaper's solution https://assetstore.unity.com/packages/tools/utilities/serialized-dictionary-243052
You don't need two lists for the key and value, you can just create a generic serializable struct like my "Pair" one
OP specified that he wanted to learn serialization in unity
Your main problem of why values do not set is because you are constantly clearing the lists, you only need to serialize the dictionary not the lists, unity already handles those. You only need to update the lists when the dictionary changes which would only happen when using Add, Remove and Clear functions, in which case you just need to reinitialize the lists with the dictionary values
as you can see in my example
Thanks a lot!
I've noticed that OnValidate seems to call before the changes to the text field actually register. Do you know if there's an easy way to get around that besides a one-frame coroutine?
afraid this hasn't helped at all :(
pic 1 is what currDialogues looks like as a custom editor propertyfield in the inspector
pic 2 is the class in the scriptableobject
pic 3 is what runs with OnValidate()
whenever I type anything into the summary text field, it flickers before being removed again. I experimented with making the OnValidate code running every 10 validates (basic int counter), and it only flickers the last character away every 10th validate, which of course isn't any good but it helps to know?
I would just settle for a one-frame coroutine, but annoyingly you can't call StartCoroutine in a scriptableobject
Firstly if you havent overwritten the inspector this should work. Secondly you cant serialize a property (you can only serialize an auto property backing field which does not apply here)
Thirdly you can use editor coroutines or async to wait for a single "editor update".
I'm using Unity's Behavior graph and I'm trying to use a Start On Event Message node to grab when the NPC's current goal has changed. I was struggling to get it to trigger with C# code so I tested it with a node where both nodes are using the same channel. It still never triggers though. Does anyone know why?
This channel is for help with writing your own editor extensions, it's unlikely that anyone here will know the answer to your question. Perhaps try #🤖┃ai-navigation
I see, thank you
can someone help me figure out why unity is reading my file errors but visual studio isnt?
its also not autofilling
!ide
If your IDE is not autocompleting code or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
@still tusk 👆
it was working like a week ago but then it just suddenly stopped working
I already tried regenerating project files
ive also tried restarting and reinstalling c# dev kit and other extensions
Try these other steps https://unity.huh.how/ide-configuration/visual-studio#if-you-are-experiencing-issues
If your IDE isn't providing autocomplete suggestions or underlining errors in red, then it needs to be configured.
im trying to give custom icons to scriptable objects but the background isnt transparent, is there a fix?
i used this video https://www.youtube.com/watch?v=lttDfhw7jhM
Have you ever wanted to assign custom icons to your scriptable objects, but didn't know how? In this short tutorial I'll show you exactly that!
Look at the code here: https://github.com/Vinark117/Tutorials/tree/main/CustomScriptableObjectIcons
Rune sprites from Kenney: https://kenney.nl/assets
If you are interested in my projects you can join ...
i figured it out alg
!code
📃 Large Code Blocks
Use links to services like:
https://pastes.dev/
https://paste.yunohost.org/
https://share.sidia.net/
https://paste.ofcode.org/
https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Is there no way to set a preview scene stage to be in 2D mode?
protected override void OnFirstTimeOpenStageInSceneView(SceneView sceneView)
{
if (_instance != null)
{
Selection.activeObject = _instance;
sceneView.in2DMode = true;
sceneView.FrameSelected(false, true);
}
}
I tried using a delayed call, I tried using two delayed calls, i tried using EditorApplication.update to delay it multiple frames. It just.. won't work.
even if the main stage is in 2D mode, it will open in 3D
in fact when I debug log it it just isnt called even when restarting unity
ah nevermind... its because I'm not using this for an asset so I was returning string.Empty for the asset path and OnFirstTimeOpenStageInSceneView wasn't being called. Overriding GetHashForStateStorage fixed this.
hey all - ive built a tool for unity that i think would be useful for the community, and im thinking about releasing it for free. was curious if this was the place to discuss this? i just want to see if there's a generla interest in the community for it!
@lilac valve was looking for a way to fix this Title bar and menus white even if its set to "dark mode" And came across this post https://issuetracker.unity3d.com/issues/the-title-and-menu-bar-are-white-when-editor-theme-is-set-to-dark
It is a old 2023 version but still "Resolution Note:
This has been the intended design for years. Closing as by design." Could you mby try to push this to someone who can revisit this? So we dont have to use 3rd part plugins. Its 2026 a whole app dark-mode should be eashy
How to reproduce:1. Create an empty project2. Click Edit → Preferences → General → Editor Theme → Dark3. Observe the title bar at th...
Sorry if its the wrong channel
Sorry, I don't work for Unity, so I can't really push anything to anyone. You used to be able to submit and vote things on the roadmap, but that seems to have gone away
Sorry most likly worded it a bit wrong. Just though you might know someone at unity who could pass it along.
It is not changing, this has been discussed on the forums and reddit and all over multiple times. It sucks but is what it is
I was gonna say a forum post on the Discussion page might help but maybe not. lol
Hmm it is a bit of a gray area in this channel. As long as you are fine with talking about what/how you did something and or input for improvement, I say it is probably okay. Just don't want to turn this in to a promo or showcase channel (not a mod, so take it as you will, I just hang around the channel a good bit)
"It sucks but is what it is" but why? foudn a simple package that is on the Unity store just one file and its fixed. I know almost nothing about window rendeing, but this just has to be a old code that was not updated for new system wide dark mode? why does the Hub app work fine
its a texture painting toolkit, mesh sculpting, texture painting, with some other features. i saw some available for purchase but none for free and figured i could release a good one for free that the community could use
Because the editor is over 20 years old, there is overhead with changing it to make sure it works on all systems and versions, and management probably feels it is not worth the dev time
I think that would be cool!
if you wanna acheck it out, still working on it so its a wip
but so far things are working well
not all version just do from The next version on?
#1179447338188673034 would be a good place to post this
feedback is welcome
any community input would be useful and credited if its a new feature or something
Neat, very first thing I would 1000% recommend is to switch to using the Tools and Overlays for the editing and painting and stuff
There is a third party package that changes the menu bar and menus to be dark on windows. Title bar colouring is a windows setting
understood, good idea
im working on sculpting but its working fine, im optimizing because perfomance is dog at a certian point but its going well and if the community could use something like this i will for sure release it for free
its a lot more work than i anticipated initially
yeah i installed it. "Title bar colouring is a windows setting" so then it is just that they have not updated it to some new API?
but so far, you can use emissives, reflective materials, any mateiral works
i am really enjoying tool creation in unity so far though its sort of a weird hobby i picked up
No you have to enable your windows colour settings to show on title bars and the task bar.
I presume modern win UI apps control the title bar but old win32 ones do not.
oh since whene was that a thing?
Quite a while and it's never on by default so yes isn't that fun
i see why its not on by default
Yeah it can be super fun!
anyone want to test my tool i built if they have any environments able to be tested in?
jsut looking for general feedback on performance, high poly meshes would be nice to test on
its a texture painting tool, has sculpting functionality, etc
why doesn't probuilder have its own inspector in mine or some thing happened?
--------- ✂ ------------
I declare this channel OPEN!
I do love editor scripting! One-click builds, toggling different GameObject containers, various debug stuff, even uploading builds too
Both my assets are editor scripting, its also what i offer for commission work cause its what im decent at/enjoy
Love editor scripting, my favorite here for a card game I am trying to make, sporadically . .
Haha, we also have a card editor too, except ours is really basic and it's used to set data for now
my first and last Unity editor extension: lets you simulate physics step by step in editor without having play mode active
was super simple to make, didn't take long, thanks to the simplicity of the tools
also discord breaks that gif 😄
it works expanded
Ah, I can see it fine, looks good @fresh yoke
my motivation to do that was mainly because I once (a long time ago) needed to place some physics objects (ragdolls etc) into level and have them start at resting where they should be
nowadays Unity has that copy / paste values thing per object but back then only option was to simulate on play mode, make a prefab of new position and the after playmode, use the prefab instead
it was horribly convoluted workflow
like, for what it did
I'm trying to make a wall editor in unity where I can drag-create rooms like how you would in rpg maker (but in 3d) and I'm having a focus issue it seems
I force the editor window to have focus when I click the create button and don't unfocus until the player clicks it again
but even when I've clicked the button again to unfocus (and it does unfocus), I can't seem to drag select or click select in the scene view
I have to select manually via hierarchy
focus is kind of a pain, trying to remember how it is dealt with, hopefully somebody chimes in
that looks sweet
it does but the guy never went into basically any detail into how he made it lol
fixed it
hah, nice, what did you do?
HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
that was at the start of my OnSceneGui and I just moved it inside an if statement so it only ran while I was creating walls
there's a utility for everything 😃
Editor scripting is fun 👌
that's cool
Thanks! It's mostly just abusing https://docs.unity3d.com/ScriptReference/AnimatedValues.AnimBool.html
solid thumbnail preview
I too love editor scripting :D
https://raw.githubusercontent.com/GlassToeStudio/UnityGlobalTextSystem/master/Images/ColorChangeRealTime.gif
So I have this code https://pastebin.com/azVwEKca. The goal was to draw a window background, then draw text on top of it. Only the first BeginGroup seems to be working, any ideas why?
You might want GUILayout.BeginArea instead of GUI.BeginGroup
also you can use GUILayout.AreaScope and it might make your code nicer and force the EndArea call
It seems that GUILayout keeps the last rect position between groups
How do you mean? Did you try using an Area?
Well the reason my pasted code doesn't "work" is because even though I'm calling BeginGroup setting the rect to 0,0,width,height Since the previous group filled out height, the next GUILayout.Label is trying to draw under the last GUILayout.Box call's rect.
Instead of over top of it
@nova scarab this is why you need to use an Area because a GUI Group does not affect GUILayout content
If I use Area passing the same rect, it doesn't draw anything.
Sorry i'm new ill put it in there
@nova scarab https://i.snag.gy/hEgBVM.jpg
Hopefully that gives you some general concepts. It's good to define the least amount of widths and heights as you can in GUILayout and let the layout handle the rest of it
with things like ExpandHeight you can ensure Styles that don't expand expand properly
You likely don't even need the calcsize stuff or any size definitions with the Output label
Additionally, it's kind of strange to have two overlapping areas like that. You can Style a scope and it draws behind the content
so I'd likely have a Horizontal scope to draw your two boxes and inside of that have two styled Vertical scopes instead of those boxes, and draw the Output label inside of the first Vertical scope if that makes sense
eg.
using (new GUILayout.AreaScope(new Rect(0, 0, 300, 300)))
{
using (new GUILayout.HorizontalScope())
{
using (new GUILayout.VerticalScope("window"))
GUILayout.Label("Output", EditorStyles.boldLabel);
using (new GUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.MinWidth(40), GUILayout.ExpandHeight(true))) { }
}
}```
I see. I feel like it's very ambiguous and doesn't make a whole lot of sense.
Thanks for your time.
The code doesn't work for me, perhaps because I'm drawing it in a GUILayout.Window callback
also there is a hidden debugger for GUI content if you want to have a peek behind the curtain
if (GUILayout.Button("GUI Debugger"))
GetWindow(Type.GetType("UnityEditor.GUIViewDebuggerWindow,UnityEditor")).Show();```
it might show where things are rendering if you think they should be
@nova scarab are you surrounding your window calls in BeginWindows(); and EndWindows(); if this is editor code
Yeah
good to see people using the scope helpers 🙂
When did those get added? Are they a replacement for BeginHorizontal and EndHorizontal etc?
They've been there forever
Search every Unity release since 3.4.0 for when API calls are present and where.
Ah interesting, it doesn’t show up in the docs for 2017
Every time I find an IDisposable I didn't know existed it is a god send
That’s a good site, thanks for the link
Ha yeah it’ll make for much better looking code
Yes editor scripting channel ❤
Here is a ladder graphic I did few days ago
Has anyone of you tried out the UIElements system?
Begin/EndHorizontal are still there, but the scope versions are there to make it harder to skip the end due to mistakes/exceptions/etc.
@lucid hedge yup, I'm using it all the time now. Slowly learning the Flex and CSS quirks
easy borders, states, inline elements
it's just much easier to make complicated stuff
I'm playing with UIElements in a way that is highly specific and likely useless to everyone, but: https://github.com/vertxxyz/NDocumentation
I made something similar for a film pipeline I made that had like 6 interdependent packages and needed documentation and tutorials, so I built a hierarchical documention window for it. This is the next iteration of that, that's been entirely rewritten and has none of the inflexible hierarchy and instead behaves similar to a webpage, but allows button and content injection across pages
Hi all, are InstanceIDs of prefabs consistent between the Editor and Builds?
I don't think instance ids are ever consistent across more than one session
That's a pity, I'm having that problem where a behaviour on a prefab is supposed to reference THAT prefab, but when you instantiate the prefab it instead of referencing the prefab it references itself. An attribute to prevent that would be great.
Couldn't you GetComponent on the thing you're about to instantiate?
Or, after instantiating, pass a reference to the original prefab along to the script
the second one is what I usually do
but yeah it is kind of annoying that it changed the reference to itself 😛
I'm trying to create a menu item that gets a mesh from the active selection and generates some stuff based off of it. I want it to work on meshes in the scene and mesh assets in the project, but I'm not sure how to get the mesh from the mesh asset.
what are you selecting in the assets in this context? an FBX or a prefab that points at the FBX?
fbx
I logged the object type of the selection when I had a mesh asset selected and it was a GameObject, which I found odd. I guess there's no reason to serialize mesh assets differently?
this is the ideal editor function, you might not like it, but this is what peak performance looks like
private static void DoMyThing()
{
GameObject temp = null;
try
{
temp = GameObject.Instantiate(Selection.activeObject as GameObject);
MeshFilter mf = temp.GetComponentInChildren<MeshFilter>();
Debug.LogError(mf.sharedMesh.vertexCount);
}
finally
{
if (temp != null)
{
GameObject.DestroyImmediate(temp);
}
}
}
```
If you're selecting the mesh itself in the project explorer, the imported asset is still the root GameObject, and not the mesh (the mesh is one of the imported 'sub' assets). Also, you can do a GetComponentInChildren<MeshFilter> on the asset GameObject directly, no need to instantiate (you may need to pass true as the second parameter, don't remember).
Another way:
// Get the selected object, forget if this is the one to use
GameObject selectedAsset = Selection.activeGameObject;
// Get the asset path for that asset
string assetPath = AssetDatabase.GetAssetPath(selectedAsset);
// Look through all the sub assets in the asset path
foreach (UnityEngine.Object subAsset in AssetDatabase.LoadAllAssetRepresentationsAtPath(assetPath))
{
Mesh meshAsset = subAsset as Mesh;
if (meshAsset != null)
{
// Found a mesh, do stuff
}
}
(I had to do something like this recently for an asset postprocessor)
It means "get the component even if it was inactive"
I don't remember if that's necessary for assets
Since technically an asset game object doesn't exist in the world, it may be that they're always considered 'inactive' but I don't remember
got it - yeah it was the "true" that was missing
private static void DoMyThing()
{
GameObject go = Selection.activeObject as GameObject;
MeshFilter mf = go.GetComponentInChildren<MeshFilter>(true);
Debug.LogError(mf.sharedMesh.vertexCount);
}
```
works
Nice - at this point I always put that in there, I'm not really sure why false is the default; can't think of any reason I'd want the Unity function to do that filtering for me
(unless it's just way faster or something)
I actually hate the imported .fbx representation - feels really opaque and magical
It is pretty annoying. The work I was doing related to it was to try to clean out everything inside except the animations, since we have some anims with blendshapes, and you can't import blendshape keyframes without having the actual blendshape in there
So we had dozens of FBX files, all with extra copies of head meshes and transform hierarchies, where all we want is the AnimationClip assets
So I wrote a postprocessor that kludgily deletes everything else after the import is finished
our post processor does auto atlassing of models as they're imported. It's nice, but it sucks that the modified UVs only exist in the Library/ folder
Yeah that's the other thing, once you start post processing assets like that there's no guarantee that all other team members will have the right representation unless they totally reimport everything
yup
I wish there was a stage in the pipe where you could modify the mesh/hierarchy and save the revised canonical version
vs having it exist magically in Lib/
The project view will show it correctly, there's just no difference from Unity's point of view between the unmodified and modified one
Since the library doesn't go in version control
It's not a huge problem as long as you get all your post processors out of the way early in development (or force everyone to do a Reimport All 😛 )
@craggy sedge @prisma chasm Thanks guys. I think I got it working now.
private static readonly string INVALID_SELECTION_ERROR = "Selection does not have a mesh.";
[MenuItem ("Tools/Deform/Create Vertex Cache")]
public static void CreateVertexCache ()
{
var selection = (GameObject)Selection.activeObject;
var target = new MeshTarget ();
target.Initialize (selection);
if (!target.HasMesh ())
{
Debug.LogError (INVALID_SELECTION_ERROR);
return;
}
var mesh = target.GetMesh ();
var cache = ScriptableObject.CreateInstance<VertexCache> ();
cache.Initialize (mesh);
AssetDatabase.CreateAsset (cache, string.Format ("Assets/{0}.asset", selection.name));
Selection.activeObject = cache;
}
I made a struct called MeshTarget that basically checks a target gameobject for a MeshFilter or SkinnedMeshRenderer and abstracts access to it so that you can get a mesh without needing to know which component the object is using.
However now I'm running into a problem with scriptable object callbacks. The scriptable object, VertexCache holds a native array for vertices, normals, uvs etc. On a MonoBehaviour I'd dispose the arrays in OnDisable, but I can't seem to find a callback for when a ScriptableObject is destroyed.
I'm logging to the console when OnDisable and OnDestroy are called, but neither get invoked when I delete the scriptable object asset. OnDisable does get called when Unity recompiles which is good, but if OnDestroy and OnDisable aren't called when the asset is deleted I don't know what else would.
tldr: I don't think there's a callback on scriptable objects for when they get deleted
hmm
you're deleting out of the project view
I don't think you get deletion callbacks in that context
ScriptableObject is a bit different from MonoBehaviour in terms of messages, but it does have OnDestroy
I don't think any of those get called for deletion of a prefab
What happens if you delete it from project view, then go File > Save Project?
I could be mistaken, but I think you might have to hook into this https://docs.unity3d.com/ScriptReference/AssetPostprocessor.OnPostprocessAllAssets.html
Yeah that might work more reliably
second arg is anything that was deleted
I think OnDestroy is only (generally) for ScriptableObjects you create at runtime, as copies of other ones
^
Although, it is weird that you would get nothing for destroying the assets
What's interesting is I'm pretty sure I use OnDisable a lot for Editors/EditorWindows
Which are scriptable objects
Though I guess those are more short-lived
Yea, that's funky. Well, thanks for pointing me in the right direction anyways
Whoever's handling the UIElement documentation, it'd be awesome to have screenshots of all the controls on this page: https://docs.unity3d.com/2019.1/Documentation/Manual/UIE-ElementRef.html
hell if they could be remade to web controls that'd be the way I'd personally like to see it done
Hey, bit of a stretch, but does anyone know of a way to load an external *.mdb into the editor? or of a way to force the editor to release locks on assemblies loaded by path?
If I load an assembly with Assembly.Load(path) unity will load the debug symbols, but will also lock the files until the editor is closed, If I use Assembly.Load(bytes) unity does not lock the file, but does not get debug symbols.
also, loading the pdb/mdb with Assembly.Load(assemblyBytes, symbolBytes) does not work either.
hm, passing symbolBytes should work for an mdb
does anyone know if you can modify UIElement styles associated with pseudo-states via code?
or what unityBackgroundImageTintColor is in USS?
there should be unityBackgroundImageTintColor
as in in a USS stylesheet - that seems to do nothing, as does -unity-background-image-tint-color which was my guess
that should be it, for example:
-unity-background-image-tint-color: rgb(137, 216, 255);
}```
huh, it just doesn't accept transparent as a keyword, I assume I have to use none
nope, that does nothing either
I really wish stylesheets had error messages! The only way I've ever managed to get one is by copying your code because it must have a false-space character in there somewhere 😠
huuuuh I think something else is happening in my specific case- sorry, and it's been working the whole time, this is extremely painful haha
to explain what I'm doing: the current light skin version of the ToolbarSearchField has busted hover and active states
so I'm trying to make them work properly
which involves setting a background image and tint
apparently I've now got the tint working - but the background image resources is finding is the dark skin image 😠
and I didn't even need the tint... gahhhh. Fixing fiddly things in UIElement is seemingly 100x harder than IMGUI
so then the question becomes how I would request skin-appropriate unity editor resources 😑 (as they seemingly have the same names)
Sent a bug report for the incomplete ToolbarSearchField control
(Case 1117293)
it's literally taken me 5 hours to re-code what took me five minutes in IMGUI, and the styles are still broken 👻
@visual stag I made one with auto-complete if you happen to be in need of that: https://github.com/marijnz/unity-autocomplete-search-field
Lol my face everytime shows up, can't remove previews in Discord? Anyway, it's not toolbar, but should be easy to change
@odd spoke to remove preview just wrap your link between < >
it will then show up like https://github.com/marijnz/unity-autocomplete-search-field
thanks!
@odd spoke I'm only interested in UIElement, and my search field already autocomplete searches across all of my relevant pages: https://github.com/vertxxyz/nDocumentation
I'm not interested in getting stuff done, only experiencing the most experimental and broken of APIs 🤣
I'm creating a list of objects which all derive from a base class, but when ever I recompile the code, all objects forget what they are and revert back to the parent class. Any idea how to stop this?
for example. the list is a list of commands and I have classes for a move command or attack command, but they all return to just baseCommand class
I'm trying to go through and refactor all my custom inspectors to use SerializedProperty so that I don't have to have a ton of gross code to allow editing multiple objects (ie: lots on LINQ on the targets array)
All of my components have private serialized fields and then public properties to abstract access to them. A lot of these properties do safety checks and clamping before setting the private field to value.
I'm not sure how to do this with SerializedProperty since tmk the control of the value is limited to the EditorGUILayout methods.
For example, I have a script that has a top and bottom float. I never want top to be less than bottom or bottom to be greater than top, but the only way I know to clamp the values is to use EditorGUILayout.Slider. In this context, a slider doesn't really work.
Slider wouldn't work here^
When I wasn't using SerializedProperties, I could just pass the GUI functions the property (c# property, not Serializedproperty) and it would work fine, but with SerializedProperty I have to recreate the safety checks used by the c# properties
The whole SerializedProperty thing seems very convenient, but if you have properties that don't directly get or set, you have to maintain those changes when modifying the backing field directly. I wish there was a better way.
I'd likely make the PropertyDrawer use a Control that has that clamping behaviour
basically make your own serialized property control
which has that clamping behaviour
you can bypass the PropertyDrawer and just use the control if it's just a custom inspector in that case
Ok, I haven't done that before but it seems like a good middle ground. In the end I'll still technically be maintain two controls: the actual c# property, and the inspector property; which sucks, but I guess that's the best I can hope for.
but you basically need to reimplement the logic, and can't really use the property logic with SerializedProperty
yeah, it's the middle ground I understand we deal with 😛
it be that way sometimes 😦 thanks for the pointer tho 😃
If you only want to maintain one clamping method you could put the clamping behaviour in a public method, then have the property and the inspector access that. But it's adds a lot of extra code :/
But at least if you want to change the behaviour you don't risk having different behaviour and weird bugs as a result
Yea I was thinking about that as well, but I really don't want to sacrifice runtime code performance for editor cleanliness. If performance isn't an issue and you don't have too many properties, that's probably the most maintainable way to do it tho.
I ended up just creating two methods:
public static void ClampedMinFloatField (SerializedProperty value, SerializedProperty min, GUIContent content)
{
EditorGUILayout.PropertyField (value, content);
if (value.floatValue < min.floatValue)
value.floatValue = min.floatValue;
}
public static void ClampedMaxFloatField (SerializedProperty value, SerializedProperty max, GUIContent content)
{
EditorGUILayout.PropertyField (value);
if (value.floatValue > max.floatValue)
value.floatValue = max.floatValue;
}
Which lets me limit how low or high a serializedproperty can go based on another serializedproperty's float value. So now I can just do this:
DeformEditorGUI.ClampedMinFloatField (properties.Top, properties.Bottom, Content.Top);
DeformEditorGUI.ClampedMaxFloatField (properties.Bottom, properties.Top, Content.Bottom);
I'm having trouble keeping items in a list serialized through an assembly. The list is of a base class but populated with derived classes. I've found a method for keeping them using ScriptableObject on this page (Under General Array Serialization)
Unity Serialization
So you are writing a really cool editor extension in Unity and things seem to be going really well. You get your data structures...
So I've made my base class a scriptableobject, but when i Create the Object that holds the list, the items are being listed as type missmatch and don't survive reload
@minor marlin Unity's serialization doesn't support polymorphism, so derived classes will get turned into base ones, hence the need for that ScriptableObject workaround. I'm not familiar with it, but if you're getting type mismatch you might want to check the type of the list matches the objects you are adding to the list.
I'm copying the script as is and trying to implement it through creating a new instance of the SerializeMe Class and storing it on another scriptable object (using [SerializeField]), then loading it in a Editor Window. It just doesn't work though. Am I just implementing it wrong?
@minor marlin I believe I may have replicated what you are doing - and I am also seeing the 'Type mismatch' shown in the editor window, however it does seem to be serializing the objects correctly after assembly reloads as long as you have the public void OnEnable() { hideFlags = HideFlags.HideAndDontSave; } part. It seems like it isn't showing them in the inspector correctly, as getting an object from the list and printing it is showing the correct types.
Cool, would you be kind enough to send me the project file please if possible?
I'm just using the script straight from the link you posted (under the General Array part), as you are doing too. The only thing I have changed is the list's access from private to public so I could access it from a MonoBehaviour I added to the scene, and I saved the scriptableobject as an asset by using the below method. ``` [MenuItem("Assets/Create/SerializeMe")]
public static void CreateAsset ()
{
SerializeMe asset = ScriptableObject.CreateInstance<SerializeMe>();
AssetDatabase.CreateAsset(asset, "Assets/SerializeMe.asset");
AssetDatabase.SaveAssets();
EditorUtility.FocusProjectWindow();
Selection.activeObject = asset;
}
And the MonoBehaviour was just this, simply for testing purposes. All I did was drag the asset onto it and hit play, after un-playing the list references were still there, even if they did say the 'mismatch' thing I think it can just be ignored as they do seem to be serializing and can be accessed through code fine. ``` public class mono : MonoBehaviour
{
public SerializeMe serializeMe;
public void OnEnable(){
MyBaseClass test = ScriptableObject.CreateInstance<MyBaseClass>();
print(test);
print(serializeMe.m_Instances);
serializeMe.m_Instances.Add(test);
print(serializeMe.m_Instances[0]);
serializeMe.m_Instances.Add(ScriptableObject.CreateInstance<ChildClass>());
print(serializeMe.m_Instances[1].GetType());
}
}```
My SerializeMe asset doesn't appear to work =(, has no data and can't be dropped onto the mono script
Oh right, apologies - I also commented out the hideFlags = HideFlags.HideAndDontSave; line in the SerializeMe class
Yeah just did that, can see it now
getting a null error on print(serializeMe.m_Instances[1].GetType()); though
and on print(serializeMe.m_Instances[0]);
Oh nvm it's working now
I broke it by adding instanced before i pressed play
Thank you very much 😃
No problem, I'm not that used to editor scripting like this so I'm glad I was able to help 😅
Doesn't appear to save after reloading the engine, all objects in list revert to baseClass. would that be a separate issue to serialisation or does it work for you?
To clarify by reloading I mean completely closing Unity and reopening it.
I'm looking into a video on how to save data to bytes anyway so hopefully this should be a better work around, that is if I can understand it >.<
Yeah closing unity and reopening it does seem to be clearing the references. Hope the bytes thing works out better
Is there a way to add an item to the project's create asset menu that calls some method? I know there's the CreateAssetMenu attribute, but that is added to a class, not a method, and I want to do the asset creation myself. I'm looking for something with functionality similar to the MenuItem attribute, but for the project window.
Ideally I could also disable (grey-out) the button based on some method or callback that returns a bool
Oh wait, project window? It should still work
The menus are literally the same ones I thought
I'll give it a test if you don't get to it first 😛
Yup, Csharp [MenuItem("Assets/Create/Hey")] static void Test() => Debug.Log("Hey"); gives me a sweet 💬 Hey
@visual stag Ah you're totally right -didn't know that, thanks!
@minor marlin You can add your scriptable object asset instance to your asset. Here's a quick example: Let's say that you have SO asset named Parent, then you create a new SO Child.
ScriptableObject child = CreateInstance<MyComponent>();
AssetDatabase.AddObjectToAsset(child, parent);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(child));
Thanks for that, I'll take a look tommorrow
This will make it attached like this and you won't lose your reference or mismatch it
Then finally if you don't want to see it you can use the HideFlags.HideInHierarchy so it's not visible, but it still exists
Thanks again 😃 looks interesting. Will have a proper look in the morning, Goodnight all
Np, if you have any question @me since I've been using this setup for a while for what you described above
Ok 😃
@grim monolith , do you have any good ways of handing cases where the added asset's script has been deleted? That happens for us some times, and there seems to be no way to delete the sub-asset. Usually you:
DestroyImmediate(subAsset, true);
But since it's script is deleted, you can't get a reference to it (LoadAllAssetsAtPath contains null instead of a reference)
We've usually either gone back in VC to restore the script, or just modified the .asset file manually, but I'm wondering if there's a better solution
how about deleting a HideInInspector Component with a missing script 🤔 I had a test level with this broken in for... ever, it's still like it right now
you may have luck with the null object actually existing in a weird limbo of Unity Null, but in my case I was passed real null ):
@coral turtle Never tried that, so I'll play around with that and see if I find find any way to delete it.
Is there a way to expose array without exposing "array size" field?
You would need to use a custom editor @zealous ice
How to find this thing?
I have this:
var allSettings = AssetDatabase.FindAssets($"t:{nameof(WaveEditorSettings)}");
if (allSettings.Length > 0 && allSettings[0] != null) {
} else {
settings = WaveEditorSettings.Init();
AssetDatabase.CreateAsset(settings, "Assets/Settings/WaveEditorSettings.asset");
Debug.Log(AssetDatabase.GetAssetPath(settings));
}
settings = AssetDatabase.LoadAssetAtPath<WaveEditorSettings>(AssetDatabase.GUIDToAssetPath(allSettings[0]));
```Is this a good approach?
If your path is always the same constant, I would skip the search and just directly do ```
var settings = AssetDatabase.LoadAssetAtPath<WaveEditorSettings>(your_constant_path);
if (settings == null)
{
settings = WaveEditorSettings.Init();
AssetDatabase.CreateAsset(settings, your_constant_path);
}
Though I think your approach is good in case a user moves the settings file somewhere
@coral turtle I think that is currently not possible, even Unity can't delete a non hidden object if the script reference is missing. At least version 2018.3.2f1 fails to delete the asset.
I have this two scripts, an for some reason any spawn point created using wave editor does not persist throughout Unity restarts
https://gist.github.com/Wokarol/165925f1c9ac52cb0812be2031bc0558
I have no idea why
are you saving the project between restarts?
Yes, of course
just askin 😄
Looks like every point created in WaveEditorHandles.cs at line 55 is not serializable
@coral turtle @visual stag Found a solution to the missing script object deletion. You can find it here: https://gitlab.com/RotaryHeart-UnityShare/subassetmissingscriptdelete
Has anyone else been having a problem with custom property drawers in 2018?
They always error out for me. Even one that does nothing at all.
What's the correct way to right align an element that scales to size?
Currently I have a Label - Flexible Space - Button however when I indent the Label it gets cut off slightly
Setting ExpandWidth to True on the label and removing the Flexible space on the Label makes the button right aligned but not scaled to size
can you grab a screenshot of what you mean exactly? It'll just clear up a few details
This is what I want but indented
This is what is happening while indented
And this is with ExpandWidth on the text and without a flexible space
They're both unfixed in size
I have ```CSharp
using (new EditorGUI.IndentLevelScope(1))
{
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.LabelField("Quite Long Text", GUILayout.MinWidth(0));
if (GUILayout.Button("Suspicious Stone"))
{
}
}
}```
and it seems to have okay behaviour
set MinWidth of the first label to something more reasonable, I just made it 0 because it didn't collapse enough
I don't have your setup for differing text lengths but it should just... work?
The button doesn't properly scale to the content though
oh, you want it to scale down to the content not just scale up, I see
could do something like:
GUIContent buttonLabel = new GUIContent("X");
Vector2 calcSize = ((GUIStyle) "button").CalcSize(buttonLabel);
if (GUILayout.Button(buttonLabel, GUILayout.Width(calcSize.x))) {}```
Hmm, that might work. I'll have to try that later
This is my error
NullReferenceException: Object reference not set to an instance of an object
SA.CameraManager.HandleRotations (System.Single d, System.Single v, System.Single h, System.Single targetSpeed) (at Assets/Scripts/Camera Scripts/CameraManager.cs:93)
SA.CameraManager.Tick (System.Single d) (at Assets/Scripts/Camera Scripts/CameraManager.cs:59)
SA.InputHandler.Update () (at Assets/Scripts/Player Controller/InputHandler.cs:36)
_
and this is the line that it is highlighting
Well something is null?
pivot probably?
I'll go check if that is the issue
yes, somehow it isn't displaying in the inspector anymore
I got my camera to work although it is still coming up with an error
NullReferenceException: Object reference not set to an instance of an object
SA.CameraManager.Init (UnityEngine.Transform t) (at Assets/Scripts/Camera Scripts/CameraManager.cs:37)
SA.InputHandler.Start () (at Assets/Scripts/Player Controller/InputHandler.cs:24)
which Highlights this line
Your camera probably isnt tagged as Main Camera
Camera.main every single time does a .FindByTag
yes I renamed it
I found a solution for my problem...
EditorUtility.SetDirty(settings.CurrentWave);
```that one single line
Use the Undo or SerializedObject-SerializedProperty workflows to support undo and to dirty your object
Why EditorGUI.DrawRect(...); isn't showing everytime?
Hey I'm having this very weird issue.
I'm using GUILayout.Toolbar
but the tabs are not linking up in edit mode
only in play mode
I assume you are styling with miniButtonLeft, miniButtonMid and miniButtonRight?
Huh, I don't think I've used a toolbar before, you can always do it manually as I specified, sucks a bit though
No I'm not doing any custom styles
ToolBarIndex = GUILayout.Toolbar(ToolBarIndex, menuOptions);
with menuOptions being a string[]
and ToolBarIndex just an int
and yeah I could style it manually
but in another tool of mine it works as it should
and I can't figure out what I'm doing wrong :p
Well, without surrounding code I don't think I can help :P
Yeah of course
Gonna try and experiment some more
because I do have a working version
I should be able to work this out :p
well
ToolBarIndex = GUILayout.Toolbar(ToolBarIndex, menuOptions, EditorStyles.miniButton);
just setting a guistyle seemed to fix it
ToolBarIndex = GUILayout.Toolbar(ToolBarIndex, menuOptions, new GUIStyle("LargeButton"));
looks even better
I wonder what was making it bug out 🤷
