#↕️┃editor-extensions
1 messages · Page 61 of 1
I've probably paid half price for the years that I've paid + half of the years that I've had my license I got it for free
I paid 0$ for all the years I've used Visaul Studio
im on my last year of student license. and after that i ll just pay for it. i ve seen I get student discount as well
I just pay for it as I really enjoy using it and I think it's worth paying for it as I use it almost every day
What annoys me about it is that VS with unity isn't really getting improvements anymore
The problem I have with JetBrains is that they will shamelessly drop support for a version in a broken state
I can't support that
and while I don't know if they have done that with Rider, they did it with ReSharper
I've had no unexpected issues with Rider's proper releases. Only some occasion funkyness with the EAP
Same
The latest EAP was entirely issue free for me though
I've noticed a few small things but it was pretty great
previous one had a refactoring bug that was rather major in one release
but, EAP, fairly expected
lol the rider comparison page is a lie?
Hmm?
They claim VS doesn't have vcs merge functionality
Where?
"Visualize, compare, revert changes in the editor"
they also say that rider has that while vs doesn't?
and that VS doesn't do cherry picks?
wtf?
it also has a code fix for setting up dependencies for types
I really didn't expect these things to be so blatant
You can make comments on that page, it's comparing two old versions of both products
VS 2019 vs16 is a few minor releases behind
They're going to look into VCS integration
but much of this stuff was introduced in the beginning of the 2019 VS cycle
I can imagine it the VS side not being updated since the release of VS 2019
That's generally how these things work as they probably barely use VS themselves
can rider debug a built version of a game when you reconfigure the deployment with a debugging version of the mono backing libs?
vs supposedly can do decompiled stuff now
afaik the decompiled integration in both is being able to step into methods that are being decompiled on the fly
looks like you can extract with VS
they JUST introduced this stuff though
in 16.5
YEah I heard about it
But I think that extract feature is just "caching" the decompiled versions
And ILSpy/DNSpy debugging of a built application (which VS uses) is very terrible in my experience
how do i get a static variable from a class into a serializedProperty?
the findproperty doesnt seem to work
static variables are not serializable
oh...
then how should I define the stacksize for my items? I need them to all have the same but keep it modifiable in the editor
ScriptableObject perhaps
I cant rly do a setValue method that scans for all instances of itemdata and apply to that should I
oh, yeah if I define it on the itemdatabase object
good point
thx
I mean, if you don't care about serialization then you can just keep it static
but then s/he can't edit it in the editor, and has to compile in order to test changes
Yes
I moved it to the inventory manager to control the size of stacks, that made more sense
for (int i = 0; i < settings.MoveForward.keys.Capacity; i++)
{
settings.MoveForward.keys[i] = EditorGUILayout.EnumPopup(settings.MoveForward.keys[i]);
}
how do i make it so you can change an enum
i have a list of enums that i want displayed so you can change them
@waxen sandal I'm glad I'm not the only one who feels like that
I really dislike dnspy
the single click navigation, non-floatable windows, etc. make the application a pita to use
err I suppose this conversation doesn't belong here
Dnspy is pretty okay but only compared to other decompilers
not sure if this is the right place, but I have a question about ScriptedImporter, I just want to know if I should see my imported data in the .meta files or not, because right now the meta files are mostly empty and I wonder if it's a bug...
This is the right place
Is there a way to have something exist in the editor in a saved scene without it being exported to bundles with the scene?
@severe python Maybe with this hide flag
https://docs.unity3d.com/ScriptReference/HideFlags.DontSaveInBuild.html
nice
It does specifically say
The object will not be saved when building a player
I don't think asset bundles would count as a player
Update on my situation: it seems I cannot explicitly redraw an int field as a pop-up even when a string array is hardcoded to it, so unfortunately I do not believe I can have a custom attribute for popups at all. Alas
Or yet the rabbit hole goes deeper
We'll see
What are you trying to do?
So do I, I am curious about your objective
not sure if this is the right place, but I have a question about ScriptedImporter, I just want to know if I should see my imported data in the .meta files or not, because right now the meta files are mostly empty and I wonder if it's a bug...
So it looks like the only values added to ScriptedImporter meta files are the fields on the importer, and not the ones for the data I add usingAddObjectToAsset. Can somebody explain why does that make sense?
@waxen sandal @onyx harness in short, I am trying to make a popup drawer by means of an attribute rather than a custom editor. It's proving more difficult than I imagined
Uhh what?
You can't really make a dropdown out of an array
I mean you can but you can't save the state
Right, so I tried using an int itself with a passed-in array to substitute it but unity doesn't want to redraw the int as a popup
That's what I thought too but I assure you it doesn't :S
Via an attribute ?
I know it works when making a custom editor, just fine. But an attribute drawer doesn't seem to obey the same rules.
PropertyDrawer is probably what you need
I got a editor window and I want to save some varaiables so they have the same value after you reopen the window. Should I use PlayerPrefs or there's a better way?
Also is there a function like Awake() for Monobehaviours but for EditorWindow?
Yes, yes.
ok so what's the function called then?
Found it! Thanks!
What is a good place for storing a custom data file (in this case, a CSV) within a Unity project for use in an Editor-only tool? I don't want to use a ScriptableObject/Asset/etc. because this file needs to be a raw CSV file that can be easily diff'd/merged externally.
Is just a random Assets/ subfolder okay?
I think Assets/Resources is going to work just fine.
...
Okay, and why not? You named Assets, but not Resources. Resources is a folder within Assets.
@left panther sort-of off topic but - what's the use case for a custom editor without the [CustomEditor(typeof(...))] attribute?
@blissful burrow It allows me to have have an editor without needing to have a selected object or an open editor widow. Say I want to have a list of buttons in the scene view pop up with a key press. I want to be able to do it at anypoint. and not to have to worry what my selected gameobject is or what editor window is open.
Okay @onyx harness , I suspected it was something like that. In my case it won't matter since this particular Unity project is only for editor tools (long story), but I should probably follow that practice regardless.
@tulip plank you can load a random asset with the assetDatabase
for example
string path = f.FullName; // Example /Users/User/New Unity Project/Assets/Test/sign 1.prefab
int pos = path.IndexOf("Assets/", StringComparison.Ordinal);
path = path.Remove(0, pos); //After Remove Assets/Test/sign 1.prefab
GameObject prefab = (GameObject)AssetDatabase.LoadAssetAtPath(path, typeof(GameObject));
In my case, the asset is a plain text file (well, a CSV), because it needs to be easily diffable/mergeable.
I don't see why you wouldn't be able to load a text file that way?
I'm not positive but I would expect the text file also be in the assetDatabase?
Yeah, I'm trying to see if there's any benefit to using the AssetDatabase.LoadAssetAtPath versus just StreamReader in that case.
StreamReader will be obviously faster
ah, neat! thanks @left panther
@blissful burrow Yea no problem. And i'm a big fan of you work and especially you long teaching streams on youtube, I've learned a lot! Happy to help you learn something new.
Inheriting from Editor isn't actually doing anything though is it? If you just had a plain class that would work as everything is static
hmmmm probably? let me go check
@visual stag Yep
@visual stag yes you are correct I dont need editor
And as long as its in an editor folder it'll still get removed from the build right?
yep
@visual stag Hey, since when did you change your avatar? 😄
Since April 1 😛
@visual stag any chance you have experience with IMGUI and can help me with my original problem?
You are in the right channel, we are many, shoot
That issue is usually caused by drawing an editor's repaint phase before doing layout
Sometimes annoying scenarios will cause that to happen and solving it can be clunky
I'm getting an error every time I start drawing a list of buttons in the scene. Like I hit shift A to open the list of buttons and it gives an error of
Aborting```
but after that it draws the buttons just fine until I try to close and reopen them which then gives me the error again
Example code ```c
[InitializeOnLoad]
public class ExampleEditor : Editor
{
static ExampleEditor()
{
SceneView.duringSceneGui += UpdateGUI;
}
~ExampleEditor()
{
SceneView.duringSceneGui -= UpdateGUI;
}
static public void UpdateGUI(SceneView sceneView)
{
if(shouldDraw)
DrawExample();
}
static void DrawExample()
{
Handles.BeginGUI();
GUILayout.BeginArea(new Rect(0, 0, 100, Screen.height));
for (int i = 0; i < 10; i++)
{
if (i == 5)
GUI.backgroundColor = Color.red;
else
GUI.backgroundColor = Color.white;
GUILayout.Button(i.ToString());
}
GUILayout.EndArea();
Handles.EndGUI();
}
}```
Re posting since it was many many messages ago
@visual stag its not just sometimes though. It is every single time I start drawing the buttons. I tried to use (sudocode) if(event == event.layout) and nothing ever gets drawn or if(event == event.repaint) which gives me an error every frame and not just when I open the menu up
ah heck thanks @left panther 💖 glad you like my stuff!
@left panther Make a check for whether the UI is being toggled On and only do the switch and first draw on the layout phase
otherwise skip that event
I'm not sure what you mean.
If layout runs right after your boolean is switched, there will be a mismatch
You must make sure the whole GUI phase is done before changing the state of the rendering
so only set should draw to true if were in the repaint event?
Let me try and see if I can set that up
basically yes
Only set it to first draw on the layout event, and after that point draw on every phase
What you can do is, set a boolean to true, to tell your script to switch shouldDraw at the right timing
it worked!!!
I just only get input from my keyboard during EventType.Repaint and it worked perfectly
thank you guys
I had been trying everything. I though I was going to have to learn how to use the new UI elements in the sceneview hahaha. I am so happy thank you all
uielements is awesome
But I couldn't find any documentaion about drawing it to the scene view camera
Any decent tutorials for UI elements / editor stuff? can do majority of basic usage of it so looking at advanced areas... Some assets I have seen have some huge sections dedicated just to editor windows etc and some of them have it compartmentalised into structured hierarchies, some have it just pinned as a simple script others have it built into dll's, so you know fishing through their scripts to find something to learn of myself is quite a lot of effort where in this case i'd prefer some form of guide
Works put me on furlough + training so this is more or less the only area I could work on for them
@severe python Hey since you are around, I just tried to register the event Mouse[Enter/Leave]WindowEvent to the root of a window, but it didnt reacted at all, is there something I am missing?
to the root visual container?
it doesn't work, it makes sense, I don't remember why
The one provided at rootVisualElement
its missing something it needs
I tried setting focusable to true
no chance
Don't worry, it was just a simple concern, other events are working fine
I bet I can find it in the search history
oh we've had this conversation before lol
oh we didn't seem to really figure it out
I use MouseOver/Out now
Fyi the internal ui elements event viewer can sometimes be helpful
‘About’ -> ‘internal’ then listed in the analysis menu I think
how do i create a foldout without creating another bool
i have this function
void CreateDropdownFor(ref List<KeyCode> keys, string name)
{
if (EditorGUILayout.BeginFoldoutHeaderGroup(show, name, EditorStyles.foldout))
{
for (int i = 0; i < keys.Capacity; i++)
{
EditorGUILayout.BeginHorizontal();
keys[i] = (KeyCode)EditorGUILayout.EnumPopup(keys[i]);
if (GUILayout.Button("Remove"))
{
keys.RemoveAt(i);
}
EditorGUILayout.EndHorizontal();
}
if (GUILayout.Button("New key"))
{
keys.Capacity = keys.Capacity + 1;
keys.Add(KeyCode.Space);
}
}
EditorGUILayout.EndFoldoutHeaderGroup();
}
that creates a drop down with a list and string
but for the drop down i need a variable 'show' which needs to be defined at the start
how do i make a foldout without this variable because i want to be able to make foldouts using one fuction
If you have a serializedProperty IsExpanded
Otherwise you can maybe do something with EditorPrefs or SessionState but I wouldn't recommend it
thankyou
thankyou
@hollow ocean is the keyword 'ref' required?
yes because it is referencing a list in a scriptable object
i decided to use session states
But a list is a reference type
i wrote it here
keys[i] = (KeyCode)EditorGUILayout.EnumPopup(keys[i]);
so you can change the keys, add or remove them
Read my answer please
🤦♂️
🤷♂️
Anyone noticed that foldouts without toggleOnLabelClick only allows you to click on the label and not on the little arrow?
Hello guys, I was wondering if any of you knew a way to replace unity's grid in the scene for an hexagonal one for instance
Doesn't progrids do something like that?
I think so but couldn't find were it's actually done ^^'
I wouldn't know where to look if you can't find it in Progrids
The animation curve pop out editor - would love to include the pop-out part in my own editor window (the same way the Animation window does) - any thoughts?
Might be able to achieve this through some hacky reflection of CurveEditor? :/
Which part exactly?
This is what I'd like to have in my editor window. I believe this is an instance of CurveEditor which is internal I think.
Ah yeah, reflection
Thanks for confirmation - will explore
Hello guys and gals
I am having an weird issue with my VS Code, because it's not showing intellisense, it only show it whenever I have already written that command before on that file of code
am I missing an extension or something?
Is it possible to setup an editor so that when you try to focus something it focuses to a more specific place
??
I'm making this kind of, mushroom platform editor controller, and I keep trying to focus on the top of the mushroom because its the playable area
but it focuses on the entire mesh which is gigantic
that seems not ideal, I swear I figrued out how to override this at one point but it was so long ago
Oh there is some kind of attribute to specify the default selected object.. hmm what was it called
@severe python this help maybe? https://docs.unity3d.com/ScriptReference/SelectionBaseAttribute.html
I suppose i could do that
it would get the job done, though its not exactly what I want\
Otherwise if you want to do something custom you might want to override OnSelectionChange
I specifically want to override the behaviour of F thats my actual goal
oh I know how to figre this out
I am having an weird issue with my VS Code, because it's not showing intellisense, it only show it whenever I have already written that command before on that file of code
@olive folio VS not recognizing the file in the project
[CustomEditor(typeof(SelectiveFocus))]
public class SelectiveFocusEditor : UnityEditor.Editor
{
void OnSceneGUI()
{
if (Event.current.type == EventType.KeyDown)
if (Event.current.keyCode == KeyCode.F)
{
Event.current.Use();
var sf = target as SelectiveFocus;
var bounds = new Bounds(sf.bounds.center + sf.transform.position, sf.bounds.size);
SceneView.lastActiveSceneView.Frame(bounds);
}
}
}
bam
is there a way to animate the editor camera?
get the camera, move it
dude did you read what i just said
editor camera
you know what the editor camera is?
I guess you are talking about the scene view's camera?
yes same thing
You see, now go back to my sentence and read it again
SceneView.currentScene.camera should get you what you want.
SceneView.currentScene.camera should get you what you want.
@gloomy chasm thanks for helping
Np, it isn't actually called currentScene, but I don't remember what it is. But it is close.
i try to find some helpful stuff, thanks for pointing in a direction
You're welcome
You're welcome
@onyx harness get lost useless
You're welcome
dude did you read what i just said
@brazen sierra You reacted like shit, what were you expecting?
You're welcome
@onyx harness if you wanna help, do it if not better be quite. you waste peoples time in my opinion
Oh I see
You are the kind of people expecting chunk of code directly to your mouth?
Welcome to this server, where there is no gamification and people are not rewarded for helping
You are the kind of people expecting chunk of code directly to your mouth?
@onyx harness if you say so 😂
@brazen sierra I don't know what you are doing. But making a Tool (like the transform tools in the top left) could be helpful too for when you want to move the camera in a certain 'mode' or something.
@brazen sierra I don't know what you are doing. But making a Tool (like the transform tools in the top left) could be helpful too for when you want to move the camera in a certain 'mode' or something.
@gloomy chasm cool idea thanks!
I helped a lot of people here, but I avoid dropping code directly, I leave the search to you, better way to learn
If you disagree, it's all fine
IHasCustomMenu
@gloomy chasm i found this lovely solution it actually does exactly what i need
http://wiki.unity3d.com/index.php/SceneViewCameraFollower?_ga=2.107915077.638032427.1587931588-745829050.1548001239
Glad that you found a solution.
@onyx harness I meant adding it to the unity dropdown when you right click on the editor. Im not sure that interface does that does it?
like this right? @onyx harness
public void AddItemsToMenu(GenericMenu menu)
{
menu.AddItem(new GUIContent("Test"), false, data => GetWindow<EditorManager>().Show(), null);
}
Yes
doesnt seem to do it
Explain
well, for editorwindows, we normally do MenuItem but I wanted to put it on the context menu when you right click in the unity editor.
What you provided is a way to add it to the settings of my editor window, I want to open that editor window the same way we can open the project window or inspector by right clicking to add a window
(didnt know I could create this kind of thing either so thx lol)
this gif should illustrate what Im trying to find
Do you see your menu item "Test"?
well, not there
in the editorwindow I can see it yes, when I click on the 3 vertical dots
Oh, IHasCustomMenu just customize the menu item of your EditorWindow
it could honestly not be accessible and be unity internal
I figured, oh well.
thx anyway, I learned a new thingie from it, even tho I didnt actually need that it could come in handy sometime
thats too bad, I wanted to add my own windows to that. no big deal tho
You could probably use Harmony if you really wanted to. Though I haven't used it my self before.
Oh really?
is that the hack thingie that allows us to change internal stuff?
yep
yeah, ima pass on that one
Hooks into methods to run other stuff before or after the original method or replacing the method completely
I have never looked in to it much. Just had people recommend it before.
I've seen it floating around and get talked about. but I've refused to use it
i made a custom property attribute that i wish to attach to scriptable object Sprite fields to change the icon of the .asset to match that Sprite, how will i go about writing the property drawer for it?
in other words, i want to take the Sprite from which the attribute is applied to and show it in place of this icon:
What exactly is against tos?
@severe python We are legally not allowed to modifiy Unity's property.
@severe python Is there a way to capture the keydown event (UIToolkit-speaking) no matter what?
Like registering from the root?
Because I tried that, but it seems that if the keydown is handled, well... I am fucked
uhm
I think you can override one of the event pipelines to get events before they can be stopped?
I read something about this recently in passing
I believe there is something on the UIToolkit forum about it
you woudln't be using the RegisterCallback methods
More like Manipulator?
I belive this, or the other one which is named similarly can be used to get events before they are dispatched to the handlers
ExecuteDefaultAction ExecuteDefaultActionAtTarget
However, I'm not sure this is how they approached it
Thank you for the insight, will look into it
check out EventHandler.cs in the Unity Reference Source, the HandleEvent method will explain how this works
its possible you could have to put a common parent right under rootVisualElement to do this
I feel like that should not be the case though
@rose tangle Here's some information on what you want
https://forum.unity.com/threads/custom-scriptableobject-icons-thumbnail.256246/
http://docs.unity3d.com/ScriptReference/AssetPreview.html
It seems this would be the thing to override to generate a custom thumbnail... is there any...
Someone already made an asset that does exactly what you want
https://assetstore.unity.com/packages/tools/utilities/asseticons-100547
yes that asset is exactly what i want to achieve but i'm writing this for a package and dont want that package to depend on any third party assets
i only want the bare minimum
in this case showing the icon for scriptable object instances
I believe this is how the above asset does it
https://answers.unity.com/questions/1011305/assign-gameobject-icons-more-than-just-one-at-a-ti.html
So that's just using Reflection to run the internal EditorGUIUtility.SetIconForObject(UnityEngine.Object obj, Texture2D icon) method.
I assume that doesn't get serialized anywhere
So you'd have to do it more than once.
@severe python Lol I found a way to catch the KeyDown event from a IMGUIContainer
I don't know why, but registering from root's parent, root and other parents did not work
Even with TrickleDown set to true or false
As soon as the IMGUIContainer gets the focus, every keydown are gone
So I decided to encapsulate the IMGUIContainer:
And it works! 😄
I am trying to create an editor window that interacts with an external local service through grpc. i'd like to use ui elements but i am not comfortable with the whole string based jquery like workflow. is there a mature project i can check out for some guidance on ui elements? the internet seems a little sparse on big projects that use ui elements...
Not that I know of
Shadergraph is sort of open source and built on UI elements
Is there a way to change execution order for InitializeOnLoad?
Both ExecutionOrderAttribute and editing execution order in the meta feel appear to do nothing
hey thanks. i'll go check it out
Trying to figure out a way to survive assembly reload, I guess I don't have much options other than creating a GO that has some serialized data?
Shadergraph is pretty complex
and uses the graph api as well
I have some projects built with UI elements but they all use my Data templating framework
so I'm not sure how much help it would be
Is there a way to change execution order for InitializeOnLoad?
@waxen sandal not really, but you can use EditorApplication.delayCall to trick it
Trying to figure out a way to survive assembly reload, I guess I don't have much options other than creating a GO that has some serialized data?
@waxen sandal UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget
It does survive domain reload
Or use SessionState
Yeah thought about that but arrays and stuff turn that into a mess
Use jsonutility to convert?
Yeah I suppose I could but I don't know exactly when the assembly reloads
Might as well just do unity gameobject serialization
Yeah I suppose I could but I don't know exactly when the assembly reloads
@waxen sandal https://docs.unity3d.com/ScriptReference/AssemblyReloadEvents.html?
anyone know if it's possible to assign custom icons to messages in the console?
anyone know if it's possible to assign custom icons to messages in the console?
@mental wind Not in the native console
ah, figures.
in that case... is it possible to hijack the message log to create a custom version of the console?
this seems like massive overkill but i'm curious now
Yes, you can code your own console
But it's gonna take a lot of time for just icons
yeah, likely not worth it!
I can imagine a much more extended version of the console with extra features that could be an interesting asset, but just for icons it's a lot of effort
Look at consoles on the asset store, there is maybe one that has it
neat, thanks 🙂
Does anyone have any experience creating an auto-completing text field in UIElements? I'm not sure where to start and unfortunately the UIElements documentation doesn't seem to have been updated in many months.
I thought about trying to coerce a GenericMenu to do what I want, but it continually steals focus away from the text field a user is typing in.
Using an editor window would be better
That's how I plan to approach it now, yeah.
It helps to know I'm not totally off-base.
Anyone know if there is a way to add a button or anything to the AdvancedDropdown? Like the new script button for the Add Component dropdown?
Unity uses some internal stuff for theirs.
@tulip plank you're trying to make a type ahead search field?
this is my SearchSuggest UIElement
its built ontop of my framework but you can probably rip out the bits you need
or use my framework
You're going to have trouble with an EditorWindow as well
you need to reflect a method in the Unity C# code that allows you to create a window without stealing focus
@severe python Oh very interesting, yeah from initial inspection this looks like what I'm trying to do.
Ahh I was worried about that (the focus-stealing).
My copy of Unity 2019.3.11f1 is running very slowly. A run of the profiler tells me that the bottleneck is UI rendering, as opposed to something like asset processing. This is on Ubuntu 19.10. Any tips?
you need to reflect a method in the Unity C# code that allows you to create a window without stealing focus
@severe python hum... Strange you don't need Reflection to keep the focus iirc
Mine is setup to get options from its children as well
I see that you've set it up to work with all the UXML stuff. I've had a hard time with that, so I hand-write most of the code. I mostly do this because whenever I've gone down the path of trying to use UXML files, I end up needing so much code-behind (for data binding, etc.) that the XML just doesn't give me much value.
I hope I'm wrong and at least in a later version of Unity it will encompass most of the things I need to do without code behind, ala XAML.
hey -- if I have an editor window that's supposed to function essentially as a separate mode for the scene view, it there a way to ignore mouse clicks on objects so there's no way to select things through the scene window?
I also need to be able to move gizmos around with handles, so I can't just switch to hand mode
did a bit more research -- GUIUtility.GetControlID(FocusType.Passive) looks like what i need if anyone was curious
@severe python
private void OppahOptionStyle(VisualElement element)
😂
lol I forgot about that
@tulip plank so that is the entire point of that framework that file is in btw
is so that you don't have to write a bunch of code behind
That repo and its sibling repo demonstrate how that all works
Oh that's awesome. If this wasn't for work, I'd be much more inclined to experiment with your framework.
that framework may evaporate at somepoint, I think I can make a version of it that is basically a single class
the whole thing basically works off the back of ContentPresenter
if you take a good look at that class you'll be able to see how I minimize the code behind, and you can see it in action in
Both repos are setup as Unity Packages, so in 2020.1+ you can add from Git and just point at these two repos to add them into a project if you want to see how it all works in action
and no, I would not use these for work atm
ultimately I want a WPF like experience in UIToolkit because its just a nicer way to work with ui
It's a really great direction, in my opinion. I hope Unity embraces this approach, too.
They are setting up a binding framework
They didn't say anything about actions, like binding a button to some method, I don't have that setup either, but its just a matter of adding it
well they said they'd like to, but they have other things that need to be done first, 1 step at a time
oh and there is binding already btw if you're not aware
I imagine you've had to dive deeply into the Unity reference source to get things to work as you'd expect? For example, the documentation on Manipulators is severely lacking and yet they're used pretty extensively in various frameworks, it seems.
from my view its just names, I'm familiar with the style of event system
actually, no thats not accurate, manipulators are a higher level thing
perhaps similar to WPF's Behaviours
Yeah they seemed that way (higher level)--actually I'm not familiar with WPF Behaviors, though. Huh, that's shameful, I should probably become familiar with those.
If you're doing WPF work, its what solves the code behind problem
But yeah I was just using that as an example of something that's not well-documented. It's kinda like "Hey there's this Manipulator thing you can use, here's one example, good luck."
I mean, you're doing MVVM anyways, but thers always that gap where stuff is just about giving functionality to views that isn't business logic
thats what behaviors are for
stuff like dragging a borderless window, that behaviour doesn't incorporate any business logic or back end data, you can make a behaviour to give the ability for an element to drag the window like it was the titlebar
Excellent, something I'll have to add to my reading list.
and the of course you can bind to/from its dependency properties
Anyways, yeah
I've read a substantial portion of the UIElements code base
Sadly, I can't say I fully understand it, there are some problems that come up with my system for data templating
works perfectly inside an inspector as far as I can tell, but putting it in an EditorWindow seems to fail for reasons I've as of yet been able to understand
I know that feeling all too well. That's what I'm going to go through today, trying to get my custom "PopUp" editor window rendering / focusing properly.
its all there in SearchSuggest
really, SearchSuggest practically stands on its own, you just have to replace ContentPresenter with your own controls or w/e instead of my dynamic system
This is a basic question but do you usually pull down the project source (if our roles were reversed), and browse through it locally, or do you just search through it on GitHub?
depends on how interested I am 😄
Okay, similar with me, then. 🙂
if I'm just looking at how someone achieved 1 thing and it doesn't branch out, I'll stick to github
if it branches out a bit, I'll grab it so I can use VS navigation
If you wanna do PRs or do your own thing with it then you should fork it
Well assuming I'm rolling all controls by hand without UXML, is your system still plug-and-play mostly?
Otherwise you can just clone it and browse it in your IDE of choice
Or browse it on Github of course
uhm
And press t on your keyboard if you're on Github
Okay, yeah, no problem then. I haven't had much luck with UXML (because of the walls I always hit that I mentioned), so it looks like I'd have to adopt much more of your framework to get it to work for my situation.
oh wait, searchSuggest doesn't even belong in this repo lol
it is completely standalone
It only needs SuggestOptions as children
Okay, that could really work then...
that class has worked perfectly for me as far as I can recall
It requires some USS styles, though.
there is an issue with styling
And a class called ToolbarSearchField.
I couldn't get styles to propogate into the created editor window
ToolbarSearchField is a built in unity style
Oh, huh, wasn't aware of that.
I did some uielement diggin
its otherwise a regular text box, but I wanted to get that style, which you may want as well tbh
style, lol I mean Control
its the same control all over unity
Ooo right.
Well I found one issue, I'm on Unity 2019 and you don't support that version. 🙂
probabl a few fields don't resolve correctly?
I know the important parts haven't changed
the 2020 values might work
The conditional using directives at the top don't have an #if UNTIY_2019, so I added it. 🙂
There's also a type called SuggestOption that isn't known.
No problem, I can resolve (most of) these, I was just letting you know
(Yeah, I saw that 😉 )
check out TypeSuggestOptions for an example
may be a bad example, TSO might need to be processed by the uxml factory (design mistake)
@severe python do you know if it is possible to do animations with UIElements? I was looking at recreating the Add Component menu dropdown but it has like a 'swipe' animation.
I believe the answer is currently no
there is basic functionality in the .experimental namespace
haven't tried it though
If I recall correctly they want to do it using CSS animation
Didnt k ow that timboc, good to know
yea ok for fun but I wouldn't rely on it... poor api and features
Worse comes to worse you can animate it in code
Suppose so. Just move the position over time. Maybe with like a animatedfloat (I think that's a thing...)
is there an easy way to set the cursor position within a uielements TextField? I'd look at the implementation on github, but it seems to be down
considering just sending arrow inputs artifically lol
someone know how I can access this property drawer pls ? you can see it on the camera inspector in HDRP
@severe python So I would just add fields like:
var searchSuggest = new SearchSuggest();
searchSuggest.Add(new SuggestOption() { DisplayName = "First Option" });
this.rootVisualElement.Add(searchSuggest);
(It's not auto-filling when I type 'F' in the search field, maybe I'm populating the options incorrectly.)
Has anyone seen this craziness? Over a million calls due to a call to EditorGUILayout.PropertyField
It takes up over 2ms
I'm trying to draw a field that uses SerializedReference using a custom property drawer, but there doesn't seem to be a way to get hold of the value of the reference field from the SerializedProperty at all?
there is SerializedProperty.managedReferenceValue which is inexplicably write only, so not sure how am I supposed to get this value out...
That does seem like it should work
@tulip plank what context are you working in
is this an editor window or an inspector?
@severe python An EditorWindow
turns out you can't manually adjust cursor position via sending arrow key messages due to the keyCode parameter being private. Am I really going to have to use reflection for something as basic as setting the text cursor position >.>
oh, I see, that isn't a use form I thought of
ez fix
and its fixed
I wasn't looking up individual SuggestOption instances, just the SuggestOptions type
Oh hah, that's service, thank you!
I don't want my use case to be too abnormal, I mean... I want to do things the Unity-expected way as much as possible without making things too difficult for me. But so far I keep resorting to hand-rolling all the UI in code.
Oh you meant the single option use case. Yeah that's just while I'm experimenting.
Oh also, while I'm being a choosey beggar, I have to manually change all the #if UNITY_2020 to #if UNITY_2020 || UNITY_2019 otherwise there are compile errors.
Very cool @severe python , it seems to mostly be working now--it just looks like the styles aren't applying (as I would expect since I don't have them), so I'll figure that bit out.
i had trouble getting the styles into the popup window
Specifically, I was trying to propogate the style inheritance properly
not quite sure why it didn't work, but I've been meaning to go back to it
Can you make new templates for Unity Hub for new projects?
@severe python Is it normal that the KeyDownEvent is fired twice when the user types in the text field? Each event has different parameters so it's easy enough to filter based on that, but it still seems odd.
Ive been trying to fix this problem for a few days now and i dont know what i need to do
I have this scriptable object which stores some data about inputs
These inputs are stored in a struct called Action which stores a list of keycodes
This is so that multiple keys can be used for the same input
This is the scriptable object
The struct doesnt appear in the inspector so i created a custom editor to be able to change the inputs. The user can add inputs, remove inputs or change current ones
This is the editor code
And this is how the editor looks like
https://gyazo.com/a72a31adef910ceb9d125e39d03690fc
My issue is that whenever you make changes to the scriptable object with the inspector, the changes do not save as when i play the game the scriptable objects values reset to its default values
How do i fix this?
@hollow ocean
EditorUtility.SetDirty(scriptableObject); AssetDatabase.SaveAssets(); you have to do something like that to your scriptable object when you don't use serialized object
i added that and it still doesnt work
you have to do that after a modification was done
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.Space(5);
EditorGUILayout.LabelField("Keyboard", EditorStyles.boldLabel);
settings.MoveForward.keys = CreateDropdownFor(settings.MoveForward.keys, "Move Forward");
settings.MoveBackward.keys = CreateDropdownFor(settings.MoveBackward.keys, "Move Backward");
settings.MoveRight.keys = CreateDropdownFor(settings.MoveRight.keys, "Move Right");
settings.MoveLeft.keys = CreateDropdownFor(settings.MoveLeft.keys, "Move Left");
EditorUtility.SetDirty(settings);
AssetDatabase.SaveAssets();
}
i do it at the end
yeah still doesnt work
Action is not Serializable
If you cannot see something via the debug inspector Unity is not saving it ever
(unless it has explicitly been hidden)
how do i make it serializable
[System.Serializable]
thank you
Also, I would use a change check scope and only dirty/save if changes are made
One question, I made a custom property drawer for my class and I got this weird behaviour were only a part of the property is rendered and I see the full property only when a change is made to the only part I can see, is this a common mistake ?
that's the editor
the class is just a serializable class with a bunch of bool and vector2
Are they 2 of the same drawer above each other?
no
You should probably override GetPropertyHeight
in the gif there is only one property in the inspector
And I'm assuming that EditorGUI.EndFoldoutHeaderGroup should be called below your elements
I'll try GetPropertyHeight
Seems like it works thansk 🙂
btw do you know what the CreatePropertyGUI is used for ?
Oh thanks I'll check that
Oddly specific question that I haven't any luck googling. Getting the error message Cancelling Display Dialog : This should not be called when a View's DrawRect Method is in progress in my EditorWindow script. The DrawRect method that is being called lives within a SceneView. What's the proper way to ensure that EditorGUI.DrawRect isn't active before creating an EditorUtility.DisplayDialog?
Maybe check the event type? https://docs.unity3d.com/ScriptReference/Event-type.html
No clue tbh
The event type is Layout, which makes sense, as it is drawing GUI rects...
Turns out I like the SceneView.ShowNotification route better anyway, so I'll just use that instead.
Im having a problem with Visual studios extensions/package that it dosen't work, it shows that it is running, but it isn't doing anything. Can someone help. If need info I will gladly give it. (Using Ubnutu, if changes anything)
guys
I have this kind of problem
could someone help me
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(PlayerArts))]
public class ArtsInspectorGUI : Editor
{
MiddleInspectorArtsScript connector;
void OnEnable()
{
connector = (MiddleInspectorArtsScript)target;
}
public override void OnInspectorGUI()
{
connector.type.typeOfArt = (PlayerArts.TypeOfArt)EditorGUILayout.EnumPopup("TypeOfArt", connector.type.typeOfArt);
switch (connector.type.typeOfArt)
{
case PlayerArts.TypeOfArt.DamageArt:
{
connector.damage = EditorGUILayout.IntField("Damage", connector.damage);
break;
}
case PlayerArts.TypeOfArt.HealingArt:
{
connector.groupHeal = EditorGUILayout.Toggle("Heal Party", connector.groupHeal);
break;
}
}
}
}
@severe python I noticed that in the OnDetached method of SearchSuggest.cs, you unregister some of the event handlers of textEntry but not the KeyDownEvent. Is there a reason for that?
now I got these problems
😦
Ah okay, good to know, I feel helpful. 
I want to spend some time on this soon, I'm in the throws of another project though
I pushed a fix for that, thanks for pointing it out
@severe python Hey, I am encountering a weird behaviour about Style.
Whenever I set the height of an element and add it to a parent, the parent changes the height to match its child.
Do you have an idea why?
the parent is in a container which has a style, everything is layouted with flexbox so your flexbox settings are causing that child to size acording to its child
its a combination of flexbox settings between the parent and its parent
I'd use the UI Debugger to mess with the flex settings
Is there an easy to disable the "flexbox"?
you can position everything using absolute coordinates
you'll hvae to have somethign at the root to make space though and you'll loose all the dynamic layouting
hum... ok I'll look into that, thanks!
So, supposing I have a custom SettingsProvider, what is the best practice for grabbing my settings object instance at run time?
i can use AssetDatabase.LoadAssetAtPath in the editor, but that obviously won't work in the build
SettingsProvider is an editor-only thing
yes, i know
If you just want your settings, which is in a scriptable object or whatever, just reference it like you would a standard object
but what if I don't want to keep referencing it every time, and don't have a global manager type deal thing?
reference it once and turn it into a singleton 🤷
context: i'm making an asset, and I can't ask of my users to wire the settings scriptableobject to every script, nor can I do it on OnValidate because the script might be added at runtime, and i wouldn't like to introduce a singleton manager just to reference that, as I don't have one yet
i would rather not have a singleton script
well, resources are required to be referenced into the build, so you can either do that via actually referencing it onto an object, the Resources folder, or something like Addressables.
To me, just requiring a single component somewhere referencing it just so it gets built, and then making it easily referencable via statics is the way I would do it
Yeah i will put it on a static once it's loaded, my question was just how to load it at all
i guess Resources it is
ooh i can sneak it into PlayerSettings.preloadedAssets
thanks for your help @visual stag
Thanks for reminding me that that exists, I always remember the shader one, but not that!
xD it happens
i actually remembered the shader one first and went to check and there was an assets one too
Hello guys, I was playing with the UIToolkit to see how it worked and so I did a custom VisualElement by creating a subclass to it as it's recommended but I can't figure out how to query the element once I'm in the c#, someone know how to get it please ?
You have a root visual element right?
yes
when I query the type that I created I get null
I can only get a template container
0.o
Should just work
I'm assuming you set a name or class right and are searching with that?
searching with that class
btw this is my inspector when I look at my element
yes
I can't even set a name for it
ohh wait
Idk how the editor works for making UI
I just imported the .uxml in the UXML
and not the element itself
you have those two that appears in your library
and obviously I choose the wrong one ^^'
Ah ok
Hello There.
The icons in my editor have suddenly gone pixelated. Anyone know how to fix it.
*?
why does this happen
@serene dust the errors are linked to you code so without seeing it, it will be difficult to find the problem
@waxen sandal How are we suppose to get the value back from any field in UIToolkit ? Since we can't just assign the value like before and I haven't found any event emitted by the fields
https://docs.unity3d.com/Manual/UIE-Events-Handling.html see registering events
Otherwise you can just find the element after adding the UXML
And set the value
Thanks, I was thinking about the part where you get your data from the view and store it in your object
does anyone know how to use DrawMeshNow in OnGUI to draw at GUI coordinates?
I get this weird offset and squish between coordinates, which I thought was because I got screen coords vs GUI coords mixed up, but, GUIUtility.GUIToScreenPoint and vice versa makes no difference
this should draw from corner to corner on the button
if I make one point of the line to follow the cursor, it's both vertically and horizontally offset
but follows well otherwise
@blissful burrow How are you constructing the transform matrix?
Matrix4x4.TRS passed into the DrawMeshNow
TRS is at identity though, the line positions are set in the shader
The shader assumes the mesh is positioned at the center of the camera/screen?
Or does the shader just position the vertices directly in clip space?
the shader doesn't really have a concept of camera/screen at this point, it positions itself on the Z plane given the two input points in local space using the MVP matrix
I thought it was possible to set up a matrix before calling drawMeshNow which would make it use correct positions, or at least transform the two points from screen space to GUI space
but it seems to make no difference if I do
I feel like I'm missing something very small
okay haha, the rectangle is even more off
thanks rectangle
hey everyone, im trying to check if my non-go objects are within the Unitys scene rect selection drag, and having trouble with the events, MouseDown always fires, but if i Use() the event it breaks the default selection rect/behavior. If i don't Use() it, then i never receive the MouseUp event. Is there a way to observe an event of another hot control without saying im going to takeover handling it.
Quick question for anyone who has used: https://docs.unity3d.com/ScriptReference/Experimental.GraphView.GraphView.html
I am looking to refresh the graph or all elements in it. No matter what I try, the graph does not update until I mouse over it the modified element. For example, I change the color of a port, but the attached edge, and port light surround do not update.
@severe python Do you think that you could accomplish the search suggestion using the PopupField<T> class that I just rediscovered? Or would it steal focus also?
if I recall correctly that popup is bound by the window sapce
but generally speaking, no I don't want to rebuild the control
Oh I'm not trying to get you to change anything, I'm just implementing my own solution and wondering why I didn't go down that path--but now I recall that being an issue, too.
yeah, thats why I made SearchSuggest in the first place
otherwise I would have just extended Popup
being bound to the window space is kinda a pita
Yeah for real. A few months ago I was going down a similar path making a custom item selector popup control, and unfortunately I forgot all the pitfalls I learned from along the way.
I'd like to make a more generic popup Window control separate from searchsuggest
Hello, I have worked on several useful unity editor extensions (which are free & open sources), here is the link of some in my devlog if it can help someone:
http://www.belfiore.ovh/page-devlogs.php
@tiny anchor some nice tools you got there have to save it for later at work 🙂
I have a bunch of groups in my addressables. Is there anything other that calling AddressableAssetSettings.BuildPlayerContent() to build my assets that is needed?
It's hard to debug as to why some of my textures are missing
2017.4.38f1 having issues getting a value to save in a scriptable object.
//SO
public InvertibleAxes _positionalInverts;
//EDITOR SCRIPT
public override void OnInspectorGUI()
{
MyScript data = (MyScript)target;
serializedObject.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(_positionalInverts, new GUIContent("Title", "Description"));
if (EditorGUI.EndChangeCheck())
{
data._positionalInverts = (InvertibleAxes);
}
Value changes in editor, EndChangeCheck returns true. If I even do Debug.Log(data._PositionalInverts.IntValue) the right value is shown.
Are you doing serializedObject.Apply?
I just realized I wasn't copying the enum when making a scriptable object instance
I use CreateInstance on my SOs passing in values and I completely forgot to add the enum
Yep I'm an idiot.
Focused so much on the editor part didn't see what was right in front of me.
_positionalInverts isn't a serializedproperty? How does that work?
it is outside what I showed
Is it possible to hijack the play button?
you can subscribe to EditorApplication.playModeStateChanged
@severe python
not exactly 'hijack' though
more like 'hitch a ride'
I guess that could work, not really ideal
what do you want to do
I'm setting up a modding environment and I want it to deploy your stuff and launch the game
Actually entering playmode isnt the end of the world
Maybe I can just obfuscate them
why not just add a menu item that does that
That's honestly what bn I'll probably end up doing
using the play button for that probably will just be more confusing
youre kinda creating a weird unexpected side effect
Well, actually I'll probably have a window for this stuff
Though, sadly uielement events in 2018 dont seem to work...
They definitely used to
To make hte UI or to execute whatever that button does?
to execute what the button does, I made a lot of small buttons to change avatars to a lot of importers at the same time, or to change the mask
but that one, I can't do it via code (it seems)
it enters, does this, reimport the model, and it keeps showing the Update Mask button in the ui
I'm trying to launch an external executable from unity using System.Diagnostics.Process but nothing happens
anyone know what thats about
just in case somone needs it, I found that you can acess it via reflection:
this one works
Nice
hi.. i need to ask something about itween rotate plugin
Please don't crosspost @loud pine. Just post your question in #💻┃unity-talk. And know that plugin related questions are more likely to get answered in their dedicated forum threads
discord more suitable for me and thanks
What is the right channel
In Unity 2018.4, if I want to generate some types before Unity actually initiates its compile,
Is there an event I can hook before each compile
thats not really before compilation
infact, it would be after compilation I think
but now that you mention it, I can look up where that is invoked in the reference source
lol, nevermind, no I can't
Hi @severe python, I've been working a lot on adapting the SearchSuggest control for my needs. It looks like you pick a fixed height of 100 for the popup window, is that true? Or maybe it auto-expands and contracts and I'm just missing it?
(In OppahOptionStyle())
yeah, I mean OppahOptionStyle shouldn't even exist
its a hack because I couldn't gett USS files loading for some reason
but IIRc you do need a fixed height
or atleast, you need to setup a system to control the height
maybe... actually I'm unsure
Sorrry, I realize that wasn't very helpful lol
Hah it's okay, well yeah, I'll need to find a way to auto-adjust the size of the popup window based on the number of items in the auto-complete ListView.
you need to look at UpdatePosition
private void UpdatePosition()
{
if (popupWindow == null) return;
var worldSpaceTextLayout = textEntry.LocalToWorld(textEntry.layout);
var windowPosition = (Rect)screenPositionProperty.GetValue(ownerObject);
var topLeft = windowPosition.position + worldSpaceTextLayout.position;
topLeft = new Vector2(topLeft.x - 3, topLeft.y + worldSpaceTextLayout.height);
popupPosition = new Rect(topLeft, new Vector2(worldSpaceTextLayout.width, 100));
#if UNITY_2020
popupWindow.rootVisualElement.style.height = 100;
popupWindow.rootVisualElement.style.width = worldSpaceTextLayout.width;
#elif UNITY_2018
popupWindow.GetRootVisualContainer().style.height = 100;
popupWindow.GetRootVisualContainer().style.width = worldSpaceTextLayout.width;
#endif
popupWindow.position = popupPosition;
}
so you'll need to height based upon this, getting a auto-adjusting height may be a bit difficult
but basically, anywhere you see height here needs to be adjusted
it automatically gets called after the option list is updated, so yuo should in theory be able to intelligently size it
infact, it would be after compilation I think
@severe pythonInitializeOnLoad
that would be after assemblies load?
its mostly a curiosity now
I was looking at generating T4 templates, but that project already exists it seems
It is called after the domain is created
which would be after compilation wouldn't it?
oh I was also looking at generating a type to provide easy access to resource paths
which would be after compilation wouldn't it?
@severe python Yes
Just in case this was missed, I want to generate types before compilation so it doesn't create a compilation loop
Can I have more context?
Why before compilation and not upon a "validation action"?
Any ideas how to get something like the blue bar ? Progressbar using like a slider in an editor window.
Isn't that exactly Superpig his blogpost?
Or you can just style a slider differnetly
oh, ya looks like im looking for that. Gonna try it out thx.
Any ideas how to get something like the blue bar ? Progressbar using like a slider in an editor window.
@uncut snow It's just drawing colored rectangles.
Nothing really special about it
yeah got it^^
@severe python Thank you, sorry for the delay. This may be a case where it will look totally fine once I have real data in my ListView, but since I only have 3 test items right now, it doesn't look great.
how can I get all children, no matter the depth, of a given Visual Element? I tried using Query<VisualElement>, but that seems to give no elements, whereas giving a more specific type works as expected
of course I could just recursively use GetChildren, but I'm more concerned why Query doesn't function as I expect
Is it true that I can't count on layout to be completed from within an AttachToPanel event?
My situation is: I want to measure the width required for a Label to display all its contents, but after constructing it, its layout width is NaN, and even after it's attached to its parent panel, it's still NaN.
@wanton kindle Have you been able to find a better reference for UQuery than this?
https://docs.unity3d.com/Manual/UIE-UQuery.html
It seems inexcusable that this is the only reference we get.
no. It seems relatively straightforward to me. Except, you know, the fact that it's not doing what I think it ought to do, hence my question above.
Yeah, I was convinced that it did get all children of a certain type.
it does seem to, just not with VisualElement
You could paste your code and there's a small chance I might be able to see what's going on.
anything other than VisualElement seems to work
Oh interesting.
thing.Query<VisualElement>().Build().ToList() is always empty for me
but just swapping VisualElement with SomethingThatInheritsFromVisualElement has it work
yes, also found this very counter-intuitive (that everything but VisualElement works) - it's not just you and please make a post on the forums
what's the reason for it? design? bug?
Interesting, what if you use a method like thing.Query<VisualElement>().First()? Does it return an item?
Also what if you omit the Build() call? Does that compile?
I'd assume it returns nothing or an error
for Build, idr
I kinda just tossed my keyboard and did my own thing after it lol
unsure whether bug or intentional - hence confirmation via forum would be good - fyi you can still use interfaces like IBindable
oh, that should work
BRILLIANT, but yeah I'll make a forum post tomorrow, or later today rather, can't keep my eyes open anymore
cool - ping me a link when you do and i'll 'like' it 😉
👍
I'm trying to size a ListView based on the width of its largest element, but every time I try to get the width of an element (they're just Labels), the width is returned as NaN.
I tried registering for the GeometryChanged callback for each of the labels in the ListView, and actually that will get me past the NaN but will be clamped by the size of the ListView. I actually want to know what the width of the label would be. There's this seemingly handy method on Labels called MeasureTextSize, which oddly takes a parameter called width (I'm trying to get the width, why are you asking me to specify it?) and that method will always just return whatever I passed into it. 🤦
This is the documentation: https://docs.unity3d.com/ScriptReference/UIElements.TextElement.MeasureTextSize.html
It is severely lacking in description of the parameters.
SOLVED: Apparently the correct incantation was:
var size = label.MeasureTextSize(label.text, 0, MeasureMode.Undefined, ...);
Do I have to write custom editors in order to have a flags enum be multiple selection
I think you can just mark it as flags no?
apparently not
I couldn't find any info on the net, so I used the same thing everyone else seems to which is a propertydrawer + field attribute
I'm pretty sure I've done that like 2 months ago
Lemme open a project
Yeah just works here @severe python
You gotta have your values right though
yea, flags works - can't do anything about having a None & All selection (other than renaming) though
[Flags]
public enum AttachmentFlags
{
/// <summary>
/// Detaches other attachments from the same hand
/// </summary>
DetachOthers = 1,
/// <summary>
/// Detaches this object from the other hand if it is attached
/// </summary>
DetachFromOtherHand = 1 << 1,
}```
That works fine for me
hmm
doesn't work for me
yeah, I still only get single selection in the editor
I'm in 2018.4
We're in 2019.3 atm but this also worked in 2019.2
And I'm confident that it worked in 2018 as well
your code doesn't work for me
which isn't surprising
definitely only get single selection on all these
Huh, guess I've always used a custom property drawer then
tbh, I also remember this being as simple as using the flags attribute, but it doesn't work
I'm pretty beginner when it comes to Unity, I was working using UE4 for the few past months but what I was going for in my project didnt seem to work in UE4
what's this file extension?
.shader
any text editor should work
@severe python So apparently FocusEventBase.relatedTarget (I'm thinking of FocusOutEvent specifically) is important. I hope that wasn't too much of a pain for you to discover, but it saved me potentially hours to see that you had made use of it.
Specifically, when I click on a list view item, if I don't check for null on that property, the listview popup will just close and the MouseDownEvent on a ListView label won't fire.
Did that trip you up when you were first implementing SearchSuggest?
are you talking about with my implemenation?
I'm not sure tbh
I expected the popup to close on click
I'm curious how you're setting things up
private void OnLostFocus(FocusOutEvent evt)
{
if (evt.relatedTarget == null) return;
hasFocus = false;
UpdateVisibility();
}
Yeah I was stealing a lot of your logic, but just for fun I commented out that null check in the first line. The result was that the popup would close when I clicked on an item, but it would never fire the MouseDownEvent on the selected Label, and thus never properly "select" the item.
oh I see
I don't recall it specifically honestly
I probably handled it like I handle most null checks
No problem, that's the type of thing that you discover and forget.
"Oh this is throwing null, I don't care about this value, early termination null check"
haha yes exactly
oh thats fun
if you do this...
public Class {
public string GetValue() => $@"
# No beer and No Cheese make homer something something
";
}
And run a build in unity, it will throw an exception, because it thinks the hashtag is for a preprocessor directive
il2cpp?
its preventing me from configuring something (lazily, to be fair) and building my assetbundles
no of course not
its a string
and unity normally compiles it fine
its just when you're doing a player build
such as building asset bundles
The fuck
thats what I'm saying bro
What is the old way to set a friendly name for Enums?
InspectorName is only in 2019+
and you could definitely do this before...
intvalue iirc
huh?
Oh friendly name nvm
@severe python Is it a known issue that moving the parent EditorWindow won't move the pop-up window along with it (re: SearchSuggest)
Cool yeah, I'm working on little fixes like that. Not sure how deep I should go before I just move on with the feature I'm working on.
the main problem I see off the top of my head is that you dont have a concept of the window moving at the UIElements level
and I'm not sure what window context you have available at all points
so the main issue woul dbe finding the appropriate root window
But that probably also suggests there a problem with moving tabs
which means you'd want to be able to catch that context as well
hmm
I would have expected geometry changed to handle these cases tbh
Yeah, I would have thought so too but I'm not getting those events when I move a window, only when I resize it (despite the GeometryChanged event saying something about it being triggered when the element moves.)
they've been pretty hands off about giving you anything with windows themselves tbh
I mean you see all the reflection I do in SearchSuggest
thats specifically because you can't open a window without stealing focus without doing reflection
Right. 
Perhaps this is a question for a beginner channel, but I can't figure out why Input.mousePosition is always returning (0,0,0) (in my editor code). I check it during random events like FocusLost or MouseDown, but always (0,0,0).
I thought Input.mousePosition always returned the current mouse position in pixel coordinates. My hint was the documentation description: "The current mouse position in pixel coordinates."
Okay. My use case is: If the popup loses focus because the user clicked outside of the EditorWindow which houses the popup, I want to call Cleanup, etc. Otherwise not.
Because currently there's a bug where, if I click outside of the EditorWindow, and then click inside the text field (or search field), the popup won't reappear. (it'll actually be hidden behind the editorwindow)
I need to know if the mouse clicked outside or inside of the editorwindow.
so the popup isn't closing?
If the popup is displayed, and the user clicks outside of its containing EditorWindow (say, on the windows taskbar), the popup won't close.
and then you click in the textbox, which doesn't ask the popup to be opened because its already open and the textbox gains focus
Exactly:)
wonder if I have that bug
I don't seem to be doing anything special
no, mine stays in front
Oh wow... are you on MacOS? I know it behaves differently for some things.
Oh whew, I was gonna have to pretend to support your decision otherwise.
Well I'm not in an inspector, I'm in a custom EditorWindow, if that makes a difference.
it could, but I don't think its the issue
showPopupNonFocus = typeof(EditorWindow).GetMethod("ShowPopupWithMode", BindingFlags.Instance | BindingFlags.NonPublic);
are you using this?
var showMode = typeof(EditorWindow).Assembly.GetType("UnityEditor.ShowMode");
showPopupNonFocus = typeof(EditorWindow).GetMethod("ShowPopupWithMode", BindingFlags.Instance | BindingFlags.NonPublic);
showValue = Enum.GetValues(showMode).GetValue((int)ShowMode.Tooltip);
showValueArray = new[] { showValue, false };
private void UpdateVisibility()
{
if (hasFocus && optionList.itemsSource.Count > 0)
{
if (popupVisible) return;
CreateNewWindow();
showPopupNonFocus.Invoke(popupWindow, showValueArray);
popupVisible = true;
}
else Cleanup();
}
the thing to note is that I'm using the Tooltip show mode
this defines the kind of window you're creating
tooltips don't take focus
Yes, I've copied your code exactly. Just to be sure, I verified the Tooltip mode and the cleanup is identical.
I am using 2019.3, if perhaps there's any issue there.
What version have you been testing in?
Okay, I may actually try that. I was too, I've just been slacking. Plus I have some customers now. 🙂
I don't think 2020.1 is even out of beta yet
But they're internal and they're used to me changing things on them, so it should be okay to upgrade.
Hmm okay, well I'm going to test it in any case.
Are you using the beta or the alpha? (I'm going to try to make it reasonably close to yours)
no problem, I'll just get the latest beta (not alpha)
haven't been doing much 2020 work lately, been stuck on 2018.4 for a mod framework I've been workin on
I miss my uielements
Oh okay. My team is working on a game in 2018, but I'm doing the tooling in a separate 2019 project (because UIElements)
You can make uielements work in 2018, but there are a lot of limitations
and well, the other day I couldn't even get an event to handle a button click
¯_(ツ)_/¯
I also wish I could use github packages
Yeah.. I mean it completely boggles my mind that suddenly Input.mousePosition is returning Vector3.zero. I used to rely on that all the time, I don't know what happened.
@severe python Hah! In 2020 it works as expected!

probably a dumb question, how do I get the label text passed into the PropertyDrawer constructor from within the propertdrawer class
rather, the label text passed into thePropertyField constructor
How do I use the new input system?
I installed it from package manager..
I changed it in player settings...
But I don't see it as
Create > Input action
As shown in videos or documents
@willow ether This channel is for creating editor extensions, #💻┃unity-talk is the correct place to ask
new UI Builder is out
What's new?
very nice update
When using EditorGUI.Foldout function to draw a foldout that has a label: unless I set the optional parameter toggleOnLabelClick to true, only the label is clickable. When false, or not present, clicking the little triangle does NOT change the state of the foldout. Clearly I am misunderstanding how this works. It’s behaving like the parameter should be called “toggleOnTriangleClick”. What am I misunderstanding?
anyone know how github extension is working ?
never mind my Q: looks like it's a bug https://issuetracker.unity3d.com/issues/input-system-package-playerinput-component-events-menu-doesnt-expand-when-clicked-directly-on-the-arrow-icon?_ga=2.19224120.1878727837.1588770002-1758085936.1506183559
To reproduce: 1. Open attached project ("case_1213781.zip") 2. Select "Test" Game Object from Hierarchy 3. In the Inspector window u...
hi i'm trying to learn ui elements but i can't get it to work. it seemes CreatePropertyGUI doesn't even get called when i try debugging it. here's the code and a picture of what currently happens... https://pastebin.com/GfcWxa1j
@stone scaffold Wrong channel
@keen pumice can confirm, ran into this last week as well, can also confirm it's fixed in the latest 2019.3
What is Sound?
Only times I've found that CreatePropertyGUI doesn't work is with animator state machine property drawers
for using UIElements?
I've personally had zero success for rendering any uielement content for PropertyDrawers, I haven't tried in a while
Work for me
what version of Unity are you on Staterz
I secretly changed our code to render everything with a IMGUI container
So I can do UIElements
But then our custom drawers for animator state machines broke
@waxen sandal Sound is nothing special. just a serializeable class with a few fields for volume etc
But not a monobehaviour?
no, it does not inherit anything
test
@severe python @jaunty furnace UIElement property drawers only work if the inspector is using UIElements.
oh of course
that probably was what the issue was that was mentioned, but I definitely misinterpreted it
that makes perfect sense
oh but that really sucks
Yeah
I mean I guess thats not hard to fix though right?
you make an Inspector that is a fallback for all MonoBehaviours ... and then I donno what
Was about to say that.
and that would just populate a buncha PropertyFields for each public property on the behaviour
and then it should just all work
You should be able to just have it call the base and not actually do anything
depends on the version of unity
in 2020 this shouldn't be an issue anymore I don't think
I think they converted most of the inspectors
Really? They did?
haven't in 2020.1 - would be interesting if they did in the alpha
no, they kinda did, but its a lie lol
they replaced the root of inspectors with an InspectorElement
and that contains an IMGUI container
Lol
oh they did? in .2? that's awesome
no thats in 2020.1b
tbh, I don't get why they haven't done the basic ones yet
its trivial
like, they could generate the code
oh wow they did - don't think that was the case in earlier 1bs? Nevertheless, great not to have a workaround
Well, either way, that should make it so UIElement properties will draw in the inspector by default now, right?
yeah, for a custom inspector definitely
but if you're trying to update like, the presentation of Vector3 globally, you wont succeed
but in STatez case it should work I think since that property type is custom it must be on a custom Inspector
welllll
I guess it doesn't have to be actually
@jaunty furnace so yeah, like Mechwarrior said, you'll need to have a custom Inspector that provides PropertyFields for the properties in the types you're inspecting
at that point your CustomPropertyDrawer should show up in those PropertyFields
@gloomy chasm do you happen to have a source for that information btw
it makes perfect sense to me, but its nice to be able to point people at docs
Yep @severe python , strangely enough the docs https://docs.unity3d.com/ScriptReference/PropertyDrawer.html
It is under the first block of example code, and right above the second.
lol, I feel like a jackass now
I'm not srue if you were being sarcrastic but it was deserved if so :p
they've been doing a great job of updating the docs this year
I was not. I was genuinely surprised that it even had an implementation for UIElements when I went to look at it a while ago.
100% was not expecting it.
the implementation has existed since they moved off the GetRootVisualElement() extension method
When EditorWindow gained .rootVisualElement they also made Editor have CreateEditorGUI or whatever its called as well as PropertyDrawers method
Yeah, I just didn't think they would have docs on it.
so, like early last year I think?
UIElements to me still feels like it is a preview feature.