#↕️┃editor-extensions

1 messages · Page 61 of 1

severe python
#

if I don't pay, I don't get upgrades?

#

no thanks, already been burned by jetbrains

steady crest
#

it goes from 139 to 88 over 3 years

#

how exactly is that expensive

waxen sandal
#

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

severe python
#

I paid 0$ for all the years I've used Visaul Studio

steady crest
#

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

visual stag
#

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

severe python
#

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

visual stag
#

I've had no unexpected issues with Rider's proper releases. Only some occasion funkyness with the EAP

waxen sandal
#

Same

visual stag
#

The latest EAP was entirely issue free for me though

waxen sandal
#

I've noticed a few small things but it was pretty great

visual stag
#

previous one had a refactoring bug that was rather major in one release

#

but, EAP, fairly expected

severe python
#

lol the rider comparison page is a lie?

waxen sandal
#

Hmm?

severe python
#

They claim VS doesn't have vcs merge functionality

waxen sandal
#

Where?

severe python
#

"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?

waxen sandal
#

Probably outdated info

#

I'll let some people know

severe python
#

it also has a code fix for setting up dependencies for types

#

I really didn't expect these things to be so blatant

visual stag
#

You can make comments on that page, it's comparing two old versions of both products

severe python
#

VS 2019 vs16 is a few minor releases behind

waxen sandal
#

They're going to look into VCS integration

severe python
#

but much of this stuff was introduced in the beginning of the 2019 VS cycle

waxen sandal
#

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

severe python
#

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

waxen sandal
#

afaik the decompiled integration in both is being able to step into methods that are being decompiled on the fly

severe python
#

looks like you can extract with VS

#

they JUST introduced this stuff though

#

in 16.5

waxen sandal
#

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

steady crest
#

how do i get a static variable from a class into a serializedProperty?

#

the findproperty doesnt seem to work

visual stag
#

static variables are not serializable

steady crest
#

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

visual stag
#

ScriptableObject perhaps

steady crest
#

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

waxen sandal
#

I mean, if you don't care about serialization then you can just keep it static

severe python
#

but then s/he can't edit it in the editor, and has to compile in order to test changes

waxen sandal
#

Yes

steady crest
#

I moved it to the inventory manager to control the size of stacks, that made more sense

hollow ocean
#
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

severe python
#

@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

waxen sandal
#

Dnspy is pretty okay but only compared to other decompilers

rough raven
#

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...

waxen sandal
#

This is the right place

severe python
#

Is there a way to have something exist in the editor in a saved scene without it being exported to bundles with the scene?

short tiger
severe python
#

nice

short tiger
#

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

cerulean musk
#

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

cerulean musk
#

Or yet the rabbit hole goes deeper

We'll see

waxen sandal
#

What are you trying to do?

onyx harness
#

So do I, I am curious about your objective

rough raven
#

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 using AddObjectToAsset. Can somebody explain why does that make sense?

cerulean musk
#

@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

waxen sandal
#

Uhh what?

#

You can't really make a dropdown out of an array

#

I mean you can but you can't save the state

cerulean musk
#

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

waxen sandal
#

That should just work

#

You're doing something wrong in that case

cerulean musk
#

That's what I thought too but I assure you it doesn't :S

waxen sandal
#

I mean I've done that

#

So I know it works

cerulean musk
#

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.

waxen sandal
#

PropertyDrawer is probably what you need

austere adder
#

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?

onyx harness
#

Yes, yes.

austere adder
#

ok so what's the function called then?
Found it! Thanks!

tulip plank
#

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?

onyx harness
#

Assets?

#

Or something at the root if you want

tulip plank
#

I think Assets/Resources is going to work just fine.

onyx harness
#

Not resources

#

Never use Resources

tulip plank
#

...

#

Okay, and why not? You named Assets, but not Resources. Resources is a folder within Assets.

onyx harness
#

Resources is embedded in the build

#

No matter what

left panther
#

@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.

tulip plank
#

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.

left panther
#

@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));
tulip plank
#

In my case, the asset is a plain text file (well, a CSV), because it needs to be easily diffable/mergeable.

left panther
#

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?

onyx harness
#

Csv would be recognized as a txt I think

#

Or you just need to load it manually

tulip plank
#

Yeah, I'm trying to see if there's any benefit to using the AssetDatabase.LoadAssetAtPath versus just StreamReader in that case.

onyx harness
#

StreamReader will be obviously faster

blissful burrow
#

ah, neat! thanks @left panther

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.

visual stag
#

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

left panther
#

hmmmm probably? let me go check

onyx harness
#

@visual stag Yep

left panther
#

@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?

visual stag
#

yep

onyx harness
#

@visual stag Hey, since when did you change your avatar? 😄

visual stag
#

Since April 1 😛

left panther
#

@visual stag any chance you have experience with IMGUI and can help me with my original problem?

onyx harness
#

You are in the right channel, we are many, shoot

visual stag
#

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

left panther
#

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

blissful burrow
#

ah heck thanks @left panther 💖 glad you like my stuff!

visual stag
#

@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

left panther
#

I'm not sure what you mean.

onyx harness
#

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

left panther
#

so only set should draw to true if were in the repaint event?

#

Let me try and see if I can set that up

onyx harness
#

basically yes

visual stag
#

Only set it to first draw on the layout event, and after that point draw on every phase

onyx harness
#

What you can do is, set a boolean to true, to tell your script to switch shouldDraw at the right timing

left panther
#

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

severe python
#

uielements is awesome

left panther
#

But I couldn't find any documentaion about drawing it to the scene view camera

grim walrus
#

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

onyx harness
#

@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?

severe python
#

to the root visual container?

#

it doesn't work, it makes sense, I don't remember why

onyx harness
#

The one provided at rootVisualElement

severe python
#

its missing something it needs

onyx harness
#

I tried setting focusable to true

#

no chance

#

Don't worry, it was just a simple concern, other events are working fine

severe python
#

I bet I can find it in the search history

#

oh we've had this conversation before lol

onyx harness
#

X)

#

Got a big moment of void, and now I'm back to it, seriously this time

severe python
#

oh we didn't seem to really figure it out

onyx harness
#

I use MouseOver/Out now

split bridge
#

Fyi the internal ui elements event viewer can sometimes be helpful

#

‘About’ -> ‘internal’ then listed in the analysis menu I think

hollow ocean
#

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

waxen sandal
#

If you have a serializedProperty IsExpanded

#

Otherwise you can maybe do something with EditorPrefs or SessionState but I wouldn't recommend it

hollow ocean
#

thankyou

onyx harness
#

thankyou
@hollow ocean is the keyword 'ref' required?

hollow ocean
#

yes because it is referencing a list in a scriptable object

#

i decided to use session states

waxen sandal
#

But a list is a reference type

onyx harness
#

You never wrote 'keys ='

#

I guess you don't need it

hollow ocean
#

i wrote it here

#

keys[i] = (KeyCode)EditorGUILayout.EnumPopup(keys[i]);

#

so you can change the keys, add or remove them

onyx harness
#

Read my answer please

onyx harness
#

🤦‍♂️

waxen sandal
#

🤷‍♂️

waxen sandal
#

Anyone noticed that foldouts without toggleOnLabelClick only allows you to click on the label and not on the little arrow?

hazy umbra
#

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

waxen sandal
#

Doesn't progrids do something like that?

hazy umbra
#

I think so but couldn't find were it's actually done ^^'

waxen sandal
#

I wouldn't know where to look if you can't find it in Progrids

split bridge
#

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? :/

waxen sandal
#

Which part exactly?

split bridge
#

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.

waxen sandal
#

Ah yeah, reflection

split bridge
#

Thanks for confirmation - will explore

olive folio
#

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?

severe python
#

Is it possible to setup an editor so that when you try to focus something it focuses to a more specific place

waxen sandal
#

??

severe python
#

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

waxen sandal
#

Only if you make your own custom thing that moves the camera

#

And stop using f

severe python
#

that seems not ideal, I swear I figrued out how to override this at one point but it was so long ago

split bridge
#

Oh there is some kind of attribute to specify the default selected object.. hmm what was it called

severe python
#

I suppose i could do that

#

it would get the job done, though its not exactly what I want\

split bridge
#

Otherwise if you want to do something custom you might want to override OnSelectionChange

severe python
#

I specifically want to override the behaviour of F thats my actual goal

#

oh I know how to figre this out

onyx harness
#

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

severe python
#
    [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

brazen sierra
#

is there a way to animate the editor camera?

onyx harness
#

get the camera, move it

brazen sierra
#

dude did you read what i just said

#

editor camera

#

you know what the editor camera is?

onyx harness
#

I guess you are talking about the scene view's camera?

brazen sierra
#

yes same thing

onyx harness
#

You see, now go back to my sentence and read it again

brazen sierra
#

wow

#

XD

gloomy chasm
#

SceneView.currentScene.camera should get you what you want.

brazen sierra
#

SceneView.currentScene.camera should get you what you want.
@gloomy chasm thanks for helping

gloomy chasm
#

Np, it isn't actually called currentScene, but I don't remember what it is. But it is close.

brazen sierra
#

i try to find some helpful stuff, thanks for pointing in a direction

onyx harness
#

You're welcome

brazen sierra
#

You're welcome
@onyx harness get lost useless

onyx harness
#

You're welcome

#

dude did you read what i just said
@brazen sierra You reacted like shit, what were you expecting?

brazen sierra
#

You're welcome
@onyx harness if you wanna help, do it if not better be quite. you waste peoples time in my opinion

onyx harness
#

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

brazen sierra
#

You are the kind of people expecting chunk of code directly to your mouth?
@onyx harness if you say so 😂

gloomy chasm
#

@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
#

@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!

onyx harness
#

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

steady crest
#

is it possible to add a custom editor window to this menu? cant find it

onyx harness
#

IHasCustomMenu

brazen sierra
gloomy chasm
#

Glad that you found a solution.

steady crest
#

@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?

onyx harness
#

It does

#

It provides you this : void AddItemsToMenu(GenericMenu menu)

steady crest
#

like this right? @onyx harness

    public void AddItemsToMenu(GenericMenu menu)
    {
        menu.AddItem(new GUIContent("Test"), false, data => GetWindow<EditorManager>().Show(), null);
    }
onyx harness
#

Yes

steady crest
#

doesnt seem to do it

onyx harness
#

Explain

steady crest
#

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

onyx harness
#

Do you see your menu item "Test"?

steady crest
#

well, not there

onyx harness
#

Not in the gif

#

but in your EditorWindow

steady crest
#

in the editorwindow I can see it yes, when I click on the 3 vertical dots

onyx harness
#

Oh, IHasCustomMenu just customize the menu item of your EditorWindow

steady crest
#

it could honestly not be accessible and be unity internal

onyx harness
#

Not the global one

#

For that, you can't, it's hardcoded

steady crest
#

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

onyx harness
#

The list of items is provided here HostView.GetPaneTypes()

steady crest
#

thats too bad, I wanted to add my own windows to that. no big deal tho

gloomy chasm
#

You could probably use Harmony if you really wanted to. Though I haven't used it my self before.

onyx harness
#

Not in this channel, since it's against the TOS

#

but yeah

gloomy chasm
#

Oh really?

steady crest
#

is that the hack thingie that allows us to change internal stuff?

onyx harness
#

yep

steady crest
#

yeah, ima pass on that one

short tiger
#

Hooks into methods to run other stuff before or after the original method or replacing the method completely

gloomy chasm
#

I have never looked in to it much. Just had people recommend it before.

steady crest
#

I've seen it floating around and get talked about. but I've refused to use it

severe python
#

What exactly is against tos?

#

You cant use harmony on the editor?

rose tangle
#

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:

onyx harness
#

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

severe python
#

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

onyx harness
#

More like Manipulator?

severe python
#

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

onyx harness
#

Thank you for the insight, will look into it

severe python
#

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

short tiger
rose tangle
#

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

short tiger
#

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.

onyx harness
#

@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

#

And it works! 😄

hoary crag
#

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...

waxen sandal
#

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

hoary crag
#

hey thanks. i'll go check it out

waxen sandal
#

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?

severe python
#

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

onyx harness
#

Is there a way to change execution order for InitializeOnLoad?
@waxen sandal not really, but you can use EditorApplication.delayCall to trick it

waxen sandal
#

Oh fuck

#

I'm not doing that

onyx harness
#

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

waxen sandal
#

Yeah thought about that but arrays and stuff turn that into a mess

onyx harness
#

Use jsonutility to convert?

waxen sandal
#

Yeah I suppose I could but I don't know exactly when the assembly reloads

#

Might as well just do unity gameobject serialization

onyx harness
waxen sandal
#

Good point

#

I'll see what I'll do tomorrow

mental wind
#

anyone know if it's possible to assign custom icons to messages in the console?

onyx harness
#

anyone know if it's possible to assign custom icons to messages in the console?
@mental wind Not in the native console

mental wind
#

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

onyx harness
#

Yes, you can code your own console

#

But it's gonna take a lot of time for just icons

mental wind
#

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

onyx harness
#

Look at consoles on the asset store, there is maybe one that has it

mental wind
#

neat, thanks 🙂

tulip plank
#

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.

waxen sandal
#

Using an editor window would be better

tulip plank
#

That's how I plan to approach it now, yeah.

#

It helps to know I'm not totally off-base.

waxen sandal
#

Nope

#

That's probably your best bet

gloomy chasm
#

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.

severe python
#

@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

tulip plank
#

@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).

trim tendon
#

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?

onyx harness
#

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

severe python
#

Mine is setup to get options from its children as well

tulip plank
#

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.

mental wind
#

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

tulip plank
#

@severe python
private void OppahOptionStyle(VisualElement element)
😂

severe python
#

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

tulip plank
#

Oh that's awesome. If this wasn't for work, I'd be much more inclined to experiment with your framework.

severe python
#

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

tulip plank
#

It's a really great direction, in my opinion. I hope Unity embraces this approach, too.

severe python
#

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

tulip plank
#

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.

severe python
#

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

tulip plank
#

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.

severe python
#

If you're doing WPF work, its what solves the code behind problem

tulip plank
#

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."

severe python
#

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

tulip plank
#

Excellent, something I'll have to add to my reading list.

severe python
#

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

tulip plank
#

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.

severe python
#

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

tulip plank
#

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?

severe python
#

depends on how interested I am 😄

tulip plank
#

Okay, similar with me, then. 🙂

severe python
#

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

waxen sandal
#

If you wanna do PRs or do your own thing with it then you should fork it

tulip plank
#

Well assuming I'm rolling all controls by hand without UXML, is your system still plug-and-play mostly?

waxen sandal
#

Otherwise you can just clone it and browse it in your IDE of choice

#

Or browse it on Github of course

severe python
#

uhm

waxen sandal
#

And press t on your keyboard if you're on Github

severe python
#

I'd have to say no?

#

but its not really something I've explored

tulip plank
#

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.

severe python
#

oh wait, searchSuggest doesn't even belong in this repo lol

#

it is completely standalone

#

It only needs SuggestOptions as children

tulip plank
#

Okay, that could really work then...

severe python
#

that class has worked perfectly for me as far as I can recall

tulip plank
#

It requires some USS styles, though.

severe python
#

there is an issue with styling

tulip plank
#

And a class called ToolbarSearchField.

severe python
#

I couldn't get styles to propogate into the created editor window

#

ToolbarSearchField is a built in unity style

tulip plank
#

Oh, huh, wasn't aware of that.

severe python
#

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

tulip plank
#

Ooo right.
Well I found one issue, I'm on Unity 2019 and you don't support that version. 🙂

severe python
#

probabl a few fields don't resolve correctly?

#

I know the important parts haven't changed

#

the 2020 values might work

tulip plank
#

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.

tulip plank
#

No problem, I can resolve (most of) these, I was just letting you know

#

(Yeah, I saw that 😉 )

severe python
#

check out TypeSuggestOptions for an example

#

may be a bad example, TSO might need to be processed by the uxml factory (design mistake)

gloomy chasm
#

@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.

severe python
#

I believe the answer is currently no

split bridge
#

there is basic functionality in the .experimental namespace

#

haven't tried it though

severe python
#

If I recall correctly they want to do it using CSS animation

#

Didnt k ow that timboc, good to know

split bridge
#

yea ok for fun but I wouldn't rely on it... poor api and features

severe python
#

Worse comes to worse you can animate it in code

gloomy chasm
#

Suppose so. Just move the position over time. Maybe with like a animatedfloat (I think that's a thing...)

wanton kindle
#

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

hazy umbra
#

someone know how I can access this property drawer pls ? you can see it on the camera inspector in HDRP

tulip plank
#

@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.)

shadow moss
#

Has anyone seen this craziness? Over a million calls due to a call to EditorGUILayout.PropertyField

#

It takes up over 2ms

rough raven
#

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...

severe python
#

That does seem like it should work

severe python
#

@tulip plank what context are you working in

#

is this an editor window or an inspector?

tulip plank
#

@severe python An EditorWindow

wanton kindle
#

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 >.>

severe python
#

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

tulip plank
#

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.

severe python
#

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?

tulip plank
#

@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.

hollow ocean
#

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

https://pastebin.com/dRYLrw0g

This is so that multiple keys can be used for the same input

This is the scriptable object

https://pastebin.com/PL9dmZXL

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

https://pastebin.com/eDWQt53T

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?

hazy umbra
#

@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

hollow ocean
#

i added that and it still doesnt work

hazy umbra
#

you have to do that after a modification was done

hollow ocean
#
    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

hazy umbra
#

add the saveAssets

#

oh

hollow ocean
#

yeah still doesnt work

visual stag
#

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)

hollow ocean
#

how do i make it serializable

visual stag
#

[System.Serializable]

hollow ocean
#

thank you

visual stag
#

Also, I would use a change check scope and only dirty/save if changes are made

hazy umbra
#

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 ?

waxen sandal
#

0.o

#

Should share code

hazy umbra
#

that's the editor

#

the class is just a serializable class with a bunch of bool and vector2

waxen sandal
#

Are they 2 of the same drawer above each other?

hazy umbra
#

no

waxen sandal
#

You should probably override GetPropertyHeight

hazy umbra
#

in the gif there is only one property in the inspector

waxen sandal
#

And I'm assuming that EditorGUI.EndFoldoutHeaderGroup should be called below your elements

hazy umbra
#

I'll try GetPropertyHeight

#

Seems like it works thansk 🙂

#

btw do you know what the CreatePropertyGUI is used for ?

waxen sandal
#

It's for UIToolkit/UIElements

#

The new retained mode UI

hazy umbra
#

Oh thanks I'll check that

plain tendon
#

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?

waxen sandal
#

No clue tbh

plain tendon
#

The event type is Layout, which makes sense, as it is drawing GUI rects...

plain tendon
#

Turns out I like the SceneView.ShowNotification route better anyway, so I'll just use that instead.

nimble shard
#

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)

serene dust
#

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;
                }


        }
    }
}

tulip plank
#

@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?

severe python
#

@tulip plank thats gonna be a bug I'd say

#

yeah definitely a bug

tulip plank
#

Ah okay, good to know, I feel helpful. catblush

severe python
#

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

serene dust
#

?

#

who tagged me

onyx harness
#

@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?

severe python
#

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

onyx harness
#

Is there an easy to disable the "flexbox"?

severe python
#

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

onyx harness
#

hum... ok I'll look into that, thanks!

severe python
#

but you can also just set the height of the parent

#

min/max/current whatever

cinder oracle
#

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

visual stag
#

SettingsProvider is an editor-only thing

cinder oracle
#

yes, i know

visual stag
#

If you just want your settings, which is in a scriptable object or whatever, just reference it like you would a standard object

cinder oracle
#

but what if I don't want to keep referencing it every time, and don't have a global manager type deal thing?

visual stag
#

reference it once and turn it into a singleton 🤷

cinder oracle
#

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

visual stag
#

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

cinder oracle
#

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

visual stag
#

Thanks for reminding me that that exists, I always remember the shader one, but not that!

cinder oracle
#

xD it happens

#

i actually remembered the shader one first and went to check and there was an assets one too

hazy umbra
#

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 ?

waxen sandal
#

You have a root visual element right?

hazy umbra
#

yes

#

when I query the type that I created I get null

#

I can only get a template container

waxen sandal
#

0.o

#

Should just work

#

I'm assuming you set a name or class right and are searching with that?

hazy umbra
#

searching with that class

waxen sandal
#

How did you create your element?

#

in UXML?

hazy umbra
#

yes

#

I can't even set a name for it

#

ohh wait

waxen sandal
#

Idk how the editor works for making UI

hazy umbra
#

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 ^^'

waxen sandal
#

Ah ok

subtle sedge
#

Hello There.
The icons in my editor have suddenly gone pixelated. Anyone know how to fix it.

#

*?

hazy umbra
#

@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

waxen sandal
#

Otherwise you can just find the element after adding the UXML

#

And set the value

hazy umbra
#

Thanks, I was thinking about the part where you get your data from the view and store it in your object

blissful burrow
#

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

#

if I make one point of the line to follow the cursor, it's both vertically and horizontally offset

#

but follows well otherwise

short tiger
#

@blissful burrow How are you constructing the transform matrix?

blissful burrow
#

Matrix4x4.TRS passed into the DrawMeshNow

#

TRS is at identity though, the line positions are set in the shader

short tiger
#

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?

blissful burrow
#

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

topaz heath
#

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.

plucky lagoon
tulip plank
#

@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?

severe python
#

if I recall correctly that popup is bound by the window sapce

#

but generally speaking, no I don't want to rebuild the control

tulip plank
#

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.

severe python
#

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

tulip plank
#

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.

severe python
#

I'd like to make a more generic popup Window control separate from searchsuggest

tiny anchor
weak spoke
#

@tiny anchor some nice tools you got there have to save it for later at work 🙂

shadow moss
#

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

earnest drift
#

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.

waxen sandal
#

Are you doing serializedObject.Apply?

earnest drift
#

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.

waxen sandal
#

_positionalInverts isn't a serializedproperty? How does that work?

earnest drift
#

it is outside what I showed

severe python
#

Is it possible to hijack the play button?

quasi monolith
#

you can subscribe to EditorApplication.playModeStateChanged

#

@severe python

#

not exactly 'hijack' though

#

more like 'hitch a ride'

severe python
#

I guess that could work, not really ideal

quasi monolith
#

what do you want to do

severe python
#

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

quasi monolith
#

why not just add a menu item that does that

severe python
#

That's honestly what bn I'll probably end up doing

quasi monolith
#

using the play button for that probably will just be more confusing

#

youre kinda creating a weird unexpected side effect

severe python
#

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

cold grotto
waxen sandal
#

To make hte UI or to execute whatever that button does?

cold grotto
#

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

severe python
#

I'm trying to launch an external executable from unity using System.Diagnostics.Process but nothing happens

#

anyone know what thats about

waxen sandal
#

Should work just fine

#

What's your code?

cold grotto
#

just in case somone needs it, I found that you can acess it via reflection:

#

this one works

waxen sandal
#

Nice

loud pine
#

hi.. i need to ask something about itween rotate plugin

pastel spruce
#

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

loud pine
#

discord more suitable for me and thanks

waxen sandal
#

You both are in the wrong channel

#

But you probably need the VS extension

restive ginkgo
#

What is the right channel

waxen sandal
severe python
#

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

severe python
#

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

tulip plank
#

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())

severe python
#

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

tulip plank
#

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.

severe python
#

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

onyx harness
#

infact, it would be after compilation I think
@severe python InitializeOnLoad

severe python
#

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

onyx harness
#

It is called after the domain is created

severe python
#

which would be after compilation wouldn't it?

#

oh I was also looking at generating a type to provide easy access to resource paths

onyx harness
#

which would be after compilation wouldn't it?
@severe python Yes

severe python
#

Just in case this was missed, I want to generate types before compilation so it doesn't create a compilation loop

onyx harness
#

Can I have more context?

#

Why before compilation and not upon a "validation action"?

uncut snow
waxen sandal
#

Isn't that exactly Superpig his blogpost?

#

Or you can just style a slider differnetly

uncut snow
#

oh, ya looks like im looking for that. Gonna try it out thx.

onyx harness
#

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

uncut snow
#

yeah got it^^

tulip plank
#

@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.

wanton kindle
#

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

tulip plank
#

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
#

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.

tulip plank
#

Yeah, I was convinced that it did get all children of a certain type.

wanton kindle
#

it does seem to, just not with VisualElement

tulip plank
#

You could paste your code and there's a small chance I might be able to see what's going on.

wanton kindle
#

anything other than VisualElement seems to work

tulip plank
#

Oh interesting.

wanton kindle
#

thing.Query<VisualElement>().Build().ToList() is always empty for me

#

but just swapping VisualElement with SomethingThatInheritsFromVisualElement has it work

split bridge
#

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

wanton kindle
#

what's the reason for it? design? bug?

tulip plank
#

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?

wanton kindle
#

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

split bridge
#

unsure whether bug or intentional - hence confirmation via forum would be good - fyi you can still use interfaces like IBindable

wanton kindle
#

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

split bridge
#

cool - ping me a link when you do and i'll 'like' it 😉

wanton kindle
#

👍

tulip plank
#

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. 🤦

#

SOLVED: Apparently the correct incantation was:
var size = label.MeasureTextSize(label.text, 0, MeasureMode.Undefined, ...);

severe python
#

Do I have to write custom editors in order to have a flags enum be multiple selection

waxen sandal
#

I think you can just mark it as flags no?

severe python
#

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

waxen sandal
#

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

split bridge
#

yea, flags works - can't do anything about having a None & All selection (other than renaming) though

waxen sandal
#
    [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

severe python
#

hmm

#

doesn't work for me

#

yeah, I still only get single selection in the editor

#

I'm in 2018.4

waxen sandal
#

We're in 2019.3 atm but this also worked in 2019.2

#

And I'm confident that it worked in 2018 as well

severe python
#

your code doesn't work for me

#

which isn't surprising

#

definitely only get single selection on all these

waxen sandal
#

Huh, guess I've always used a custom property drawer then

severe python
#

tbh, I also remember this being as simple as using the flags attribute, but it doesn't work

waxen rune
#

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

waxen sandal
#

.shader

waxen rune
#

What do I open it with

#

if I even do open it with anything

wanton kindle
#

any text editor should work

tulip plank
#

@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?

severe python
#

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

tulip plank
#
private void OnLostFocus(FocusOutEvent evt)
{
    if (evt.relatedTarget == null) return;
    hasFocus = false;
    UpdateVisibility();
}
severe python
#

hmm nm thats not realyl relevant

tulip plank
#

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.

severe python
#

oh I see

#

I don't recall it specifically honestly

#

I probably handled it like I handle most null checks

tulip plank
#

No problem, that's the type of thing that you discover and forget.

severe python
#

"Oh this is throwing null, I don't care about this value, early termination null check"

tulip plank
#

haha yes exactly

severe python
#

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

waxen sandal
#

il2cpp?

severe python
#

nope

#

.net 4.x, net standard 2.0 api compat

#

mono back end

waxen sandal
#

0.o

#

Does that happen if you compile it outside of Unity?

severe python
#

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

waxen sandal
#

The fuck

severe python
#

thats what I'm saying bro

severe python
#

What is the old way to set a friendly name for Enums?

#

InspectorName is only in 2019+

#

and you could definitely do this before...

waxen sandal
#

intvalue iirc

severe python
#

huh?

waxen sandal
#

Oh friendly name nvm

tulip plank
#

@severe python Is it a known issue that moving the parent EditorWindow won't move the pop-up window along with it (re: SearchSuggest)

severe python
#

yeah I think so

#

Theoretically simple to fix, emphasis on theoretical

tulip plank
#

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.

severe python
#

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

tulip plank
#

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.)

severe python
#

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

tulip plank
#

Right. kermitsad

tulip plank
#

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."

severe python
#

you can get that info on Panel

tulip plank
#

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.

severe python
#

oh

#

Why do you need to know where the mouse was clicked

tulip plank
#

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.

severe python
#

so the popup isn't closing?

tulip plank
#

If the popup is displayed, and the user clicks outside of its containing EditorWindow (say, on the windows taskbar), the popup won't close.

severe python
#

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

tulip plank
#

Exactly:)

severe python
#

wonder if I have that bug

#

I don't seem to be doing anything special

#

no, mine stays in front

tulip plank
#

Oh wow... are you on MacOS? I know it behaves differently for some things.

severe python
#

no way, windows all the way

tulip plank
#

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.

severe python
#

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();
        }
tulip plank
severe python
#

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

tulip plank
#

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.

severe python
#

oh I haven't been testing on 2019

#

I'm not sure if I have a verison of 2019 atm

tulip plank
#

What version have you been testing in?

severe python
#

2020

#

I'm a bleeding edge guy

#

but I think I did this originally in 2019

tulip plank
#

Okay, I may actually try that. I was too, I've just been slacking. Plus I have some customers now. 🙂

severe python
#

I don't think 2020.1 is even out of beta yet

tulip plank
#

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)

severe python
#

I'm on 1.0b1.3256

#

probably a bit out of date now

tulip plank
#

no problem, I'll just get the latest beta (not alpha)

severe python
#

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

tulip plank
#

Oh okay. My team is working on a game in 2018, but I'm doing the tooling in a separate 2019 project (because UIElements)

severe python
#

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

tulip plank
#

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
#

theres always win32

#

😄

tulip plank
#

@severe python Hah! In 2020 it works as expected!
thisisfinefire

severe python
#

ahhh

#

good to know

wanton kindle
#

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

willow ether
#

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

visual stag
#

@willow ether This channel is for creating editor extensions, #💻┃unity-talk is the correct place to ask

willow ether
#

Ok TY

#

I thought it was an editor extension.... Sorry my bad

split bridge
#

new UI Builder is out

onyx harness
#

What's new?

stone scaffold
#

hi

#

can someone help me with the github unity extention ?

severe python
#

very nice update

keen pumice
#

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?

stone scaffold
#

anyone know how github extension is working ?

keen pumice
jaunty furnace
waxen sandal
#

@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

severe python
#

There are issues with PropertyDrawer

#

let me see if I can get a source

waxen sandal
#

What is Sound?

#

Only times I've found that CreatePropertyGUI doesn't work is with animator state machine property drawers

severe python
#

for using UIElements?

waxen sandal
#

Yeah

#

They're also not going to fix it

severe python
#

I've personally had zero success for rendering any uielement content for PropertyDrawers, I haven't tried in a while

waxen sandal
#

Work for me

severe python
#

what version of Unity are you on Staterz

waxen sandal
#

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

jaunty furnace
#

@waxen sandal Sound is nothing special. just a serializeable class with a few fields for volume etc

waxen sandal
#

But not a monobehaviour?

jaunty furnace
#

no, it does not inherit anything

fair thorn
#

test

gloomy chasm
#

@severe python @jaunty furnace UIElement property drawers only work if the inspector is using UIElements.

severe python
#

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

gloomy chasm
#

Yeah

severe python
#

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

gloomy chasm
#

Was about to say that.

severe python
#

and that would just populate a buncha PropertyFields for each public property on the behaviour

#

and then it should just all work

gloomy chasm
#

You should be able to just have it call the base and not actually do anything

severe python
#

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

gloomy chasm
#

Really? They did?

severe python
#

I coudl be wrong, but it looks like they did to me

#

let me actually check

split bridge
#

haven't in 2020.1 - would be interesting if they did in the alpha

severe python
#

no, they kinda did, but its a lie lol

#

they replaced the root of inspectors with an InspectorElement

#

and that contains an IMGUI container

gloomy chasm
#

Lol

split bridge
#

oh they did? in .2? that's awesome

severe python
#

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

split bridge
#

oh wow they did - don't think that was the case in earlier 1bs? Nevertheless, great not to have a workaround

gloomy chasm
#

Well, either way, that should make it so UIElement properties will draw in the inspector by default now, right?

severe python
#

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

gloomy chasm
severe python
#

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

gloomy chasm
#

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.

severe python
#

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

gloomy chasm
#

Yeah, I just didn't think they would have docs on it.

severe python
#

so, like early last year I think?

gloomy chasm
#

UIElements to me still feels like it is a preview feature.

severe python
#

well, from my perspective, IMGUI feels like a preview feature

#

and UIElements feels like a great UI system that is missing a few features that would make it awesome

#

Mainly binding and data templating