#↕️┃editor-extensions

1 messages · Page 66 of 1

severe python
#

I don't know that one, I'm not sure I've even used an enum field

#

I personally hate enums overall

steady crest
#

I dont use them a lot, just for typesafety for my writer in the UI. im just storing them internally as integers

#

huh, how do I even represent > and < for a selector with UIE

severe cliff
#

Make a sprite? Cuz I saw Unity tends to make Chevrons sprites for their UI

steady crest
#

that would work

full vault
#

Hello

#

How to dynamically load items into this list?

#

i have this scripteble object

#

and wanna add this prefabs array to context menu

severe cliff
#

Hello
@full vault Ur 1st image is kinda hard to see

full vault
#

sry

#

there MenuTitem

#

custom which i create via attr

severe cliff
#

@full vault use Resource.Load to load ur prefab?

full vault
#

how i can dynamic add to list there?

severe cliff
#

Well u just load the items and add them in lol, I would suggest use a button to do it, cuz u don't want to run that function on update

severe python
#

@full vault protip when screenshoting, Windows key + shift + S will let you maintain open context menus

#

As far as the menu items

#

There are methods you can call to add items to the context menu without using Attributes, which you would need to do in this case

#

Courtesy of Vertx

full vault
#

omg

severe python
#

no problemo

full vault
#
addMenuItem.Invoke(null, new object[]
            {
                $"GameObject/Room/Components/c {i}",
                string.Empty,
                false,
                i,
                (Action) (() => Debug.Log(j)),
                (Func<bool>) (() => true)
            });

what is parameters?

#
$"GameObject/Room/Components/c {i}", //path+name
                string.Empty,   //?
                false,  //?
                -i, //order
                (Action) (() => Debug.Log(j)), //action on press
                (Func<bool>) (() => true)  //can execute
severe python
#

I dont know myself, you'd have to look at the unity reference source

full vault
#

and how remove it from list?

severe python
#

Unfortuantely, that doesn't appear to exist

#

thats how this answer even came up

#

I was looking for a way to dynamically remove menu items

full vault
#

@severe python solve it

#
MethodInfo rm = typeof(Menu).GetMethod("RemoveMenuItem", BindingFlags.Static | BindingFlags.NonPublic);
        rm.Invoke(null, new object[]
            {
            "menupath+name"
            });
#

all what we can using menu

#

It was nice to work together)))

severe python
#

wait so you can remove?

#

maybe it was a version I was on

full vault
#

yes

severe python
#

super

snow bone
#

my question keeps getting removed from here

#

i type it out and it auto deletes

#

I'm trying to Update an array field in the inspector

#

[SerializeField] public CombatState[] combatStates; #if UNITY_EDITOR protected void OnGUI() { var states = GetComponents<CombatState>(); combatStates = states; } #endif

#

When I add or remove states to the inspector, it doesn't update the array properly

#

i've tried using OnValidate() also but that doesn't work either.

full vault
#

How i can dynamicaly load assets or ScriptibleObject?

#

And store data

magic lintel
#

wdym by dinamically?

#

for assets, you use resource load

#

Scriptable Objects arent really modificable on runtime (any changes you make to them in runtime only survive while the game is running), so if you plan to use them for saving data, you will need to serialize them as json and load them back

waxen sandal
#

Do you know what channel you're in @magic lintel ?

magic lintel
#

yes?

waxen sandal
#

AssetDatabase.LoadAssetAtPath and you should use SerializedObjects to modify them to get proper undo and serialization support

snow bone
#

how can i update the array in the component each time a component is added to the inspector?

magic lintel
#

@waxen sandal Passive aggressiveness isn't a good way to tell somebody they gave a wrong answer btw Specially about one with 0 context

severe python
#

Could he have responded better to your statements, sure, but this is Editor Extensions, the context that is there is that this is for an edit time change

#

there is definitely more than 0 context here

waxen sandal
#

@snow bone Do you need something that runs every time the inspector is changed or only the first time?

#

Because if it's only the first time it sounds like you can do it in Awake when you enter playmode?

#

You can use the OnValidate callback to change it every time something is changed in the component through the inspector

#

Or you can write a custom editor that checks whether a specific value has changed

#

In both those ways you can also just check if your variable is already set; if not you can generate your value and otherwise do nothing

full vault
#

Can I somehow track changes within a specific folder? delete / add as well as update inside an object?

magic lintel
#

@severe python yeah but its an editor extension, you can easily load assets or SO "dynamically" by having them exposed as serialized variables

waxen sandal
#

There are asset import callbacks where you can check if they're in a specific directory

severe python
#

@full vault If you want to track changes to the FileSystem you can use a FileSystemWatcher

waxen sandal
#

FileSystemWatcher is quite performance intensive to run though iirc

severe python
#

if you want unity level tracking, Navi is correct

#

depends on how you use it

waxen sandal
#

True, last time I heard it was more a thing you can use if you have nothing else to use

full vault
#

I want when changing inside the folder my context menu is updated

severe python
#

for a specific asset type?

#

what I've done for something that sounds similar is that my type keeps track of itself in a static field

#

so when a new instance is created I add it to that static field

#

I forget what I did exactly tbh

#

I think you probably want this if its available to you

full vault
#

okay. I have a Components menu. there will be a list inside. How to update this list from time to time?

severe python
#

you could always register a callback on EditorApplication.update and do your check and updates there

snow bone
#

@waxen sandal thanks

#

anyone know how to use EditorGUI.BeginChangeCheck

#

i'm having difficulty finding any documentation or examples

#

the unity doc for it is completely lacking

snow bone
#

Is there a method or something that is triggered when an object in the inspector is changed perhaps?

whole steppe
#

@snow bone try OnValidate()

snow bone
#

I solved that already, but thanks.

#

the answer was to add a [ExecuteOnEditMode] attribute to the class and just use OnGUI, as neither is called when a component is deleted

#

I'm trying to make a popup that contains a list of Components in an array, that has been assigned in the inspector

{
    [SerializeField] private CombatStyle[] combatStyles;
}
public class CombatStyleManagerEditor : Editor 
{
    private SerializedProperty combatStyles;
    int choiceIndex = 0;
    protected void OnEnable() 
    {
        combatStyles = serializedObject.FindProperty("combatStyles");
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        serializedObject.Update();
        EditorGUILayout.Popup(choiceIndex, combatStyles);
        serializedObject.ApplyModifiedProperties();
    }
}```
#

this doesn't work, as the pupup method requires a string, but is something like what I want

onyx harness
#

Maybe get the hash, if it changes, update the strings

snow bone
#

I found an answer.

onyx harness
#

Good

vivid lily
#

Is there a way I can create custom attributes that generates code?

snow bone
#

you can code your own attributes to do stuff, so yes, but I don't know how

#

and making your own code and putting it in a file is just a matter of file serialization

#

however, to make a code file to be compiled and run during runtime execution is a different kettle of fish entirely, which I would strongly advise you leave well alone from

#

have you thought about using code snippets, they are much easier to do

#

use a key combination and VS will paste the contents of the code snippet into your code.

vivid lily
#

I want to make an utility package

snow bone
#

do a google for "unity create my own attribute" you'll get some answers from that

#

native c# has file IO functions for serializing text to a file

steady crest
#

Should my conditional nodes be different nodes in a node editor? I have 3 nodes that each have different parameters, but my writer asked if I could put them in a single node. They re all conditional nodes, but one needs a function reference, another needs a number and another needs a reference to an object. I am thinking since they hold different data they should be different nodes but I could also make them the same "conditional node" with a type dropdown.

waxen sandal
#

You can serialize generics now using SerializeReference so I don't think you need one giant conditional class

#

Your nodes in your editor should really only be a visualization of your model layer

#

But I think the better question is, how are you going to get a method reference in your data?

#

Since you'd probably need an instance to check right?

steady crest
#

ow yeah shit

#

I was gonna attach a script to my graphrunner and reflect/invoke the functions tbh

#

make a little dropdown to select the invokable functions, which I would store the names of in a list. or is that a horrible idea @waxen sandal

waxen sandal
#

That's a fine idea

#

But what if you want to do things relating to one of the characters in the dialogue

#

Or based on a world event

#

Will you make method for all of those?

steady crest
#

well no, I reflect a method with a parameter field as well. no?

waxen sandal
#

Does your graph data live in the scene?

#

Or as a SO?

steady crest
#

SO

waxen sandal
#

Then how are you going to serialize a reference to an object in the scene?

steady crest
#

the SO would only need to interact with the player, its controller (npc) or the world. which are available at all times when the npc exists

#

cuz those references will also be passed into the npc at creation

waxen sandal
#

Right but an object in your project view can't have a reference to anything in your scene

steady crest
#

you can if its a prefab tho

#

right?

waxen sandal
#

Sure but you're going to be instantiating your prefab

#

So your reference will be getting data from an instance with preset data

steady crest
#

fuck?

waxen sandal
#

Yes

steady crest
#

I could make a base npc class and have overridable functions for it. Have it hold a reference to the SO. but that requires me to write a class for every npc 🤔

waxen sandal
#

I'd just make a bunch of preset targets

#

Like current speaking character

#

Then resolve those in your dialogue runner

steady crest
#

are you thinking a dialogue runner is on the npc or somt global that controls printing to the screen as well?

#

and is told who is speaking

#

cuz I would think having it on the npc and sending data to a printer to print it to the screen is the best idea

waxen sandal
#

Some thing that has a reference to both your NPCs and your dialogue then something else that handles the UI

steady crest
#

why do you separate the dialogue runner from the npc?

waxen sandal
#

Because it's irrelevant for the dialogue runner to have a specific NPC

#

It just cares about X characters in a dialogue

steady crest
#

fair

#

another one, do I make all my nodes and make the system work before getting into properly storing data or should I be doing that on a node by node basis

#

as in serializing it

waxen sandal
#

Well if you figure out that your idea for serializing doesn't work then your system is pretty useless isn't it 😉

steady crest
#

I mean yeah, but you gotta just find a way to save it. but I wonder if its better to do it once you have everything working and know exaclty which data needs to be saved for each node

#

but each node needs to be serialized separately anyway so its kinda idk

waxen sandal
#

You got to get your basic idea of your data layer working

#

Then you can build on top of that

steady crest
#

fairs

#

should work on a generic node serializer, then expand and populate with more nodes

severe cliff
#

What I do is I take the saved Graph asset put into a monobehaviour and build a runtime tree .

#

With this way Runtime Tree is a transient data that lives in scene

waxen sandal
#

But your "source" graph is still an asset so you can't save reference to that scene right?

severe cliff
#

yup

#

So have to find a way to use the Runtime Tree to get the reference

dark grove
#

how can I save PlayerSettings with code so everything will be ready for version controll after running script?

zealous coral
#

anybody happen to know how do i manually draw this section of a monobehaviour with editor API ?

steady crest
#

does anyone use any specific tools to document their assets code?
I need to write some documentation for my team members. Do I just write that inside an editorwindow?

short tiger
#

@steady crest What kind of documentation? Do you want to explain what something does or also how it does it?

steady crest
#

mostly how it should be used

short tiger
#

If they only need to know what, then a ///<summary> documentation comment makes the most sense and will show as hints in most IDEs

steady crest
#

that would require him to use an IDE, he is not a programmer 🙂

short tiger
#

There's the [Tooltip] attribute

waxen sandal
#

We use Confluence

steady crest
#

I made a stencil mask for walls to clip out so the player can be seen throuhg em but im 100% sure it wont work when he tries it cuz you need to give the walls you want to have do taht a specific material so it can clip it

#

@waxen sandal looking good and free up to 10 users 🙂

waxen sandal
#

Oh I forgot to say it's pretty shit

#

But there's not really anything better 😛

steady crest
#

lol

#

it looks pretty ok, in what way is it shitty? @waxen sandal

waxen sandal
#

Lots of small bugs

#

Like sometimes it seems to delete the first letter of your page

#

Or the header styles that you can set no longer work correctly

#

Things like that

steady crest
#

Delete the first letter of a page

#

what

waxen sandal
#

I don't know

steady crest
#

well i cant create a page

#

lol

waxen sandal
#

Well..

#

We use self hosted by the wya

#

So it might be fixed in newer versions

steady crest
#

I see

#

I think i ll just use a html template

waxen sandal
#

That's such a mess to maintain imo

steady crest
#

there should be some npm package to get for that tho

#

otherwise its like 2 components, a side navbar and a main window for the data

#

should take like an hour or 2 to write myself xD

somber mesa
#

Heya everyone. Not sure if this is the right channel for this. but got a question: Im trying to setup MeshSync between Maya and Unity : https://github.com/unity3d-jp/MeshSync

#

But the problem is that I cant seem to find the DCC plugin download for maya...

#

the documentation says they should be in the releases but there are no plugins there ... ??????

#

The build process for these^ looks out of my league.. Im going crazy because I swear they had the DCC plugin builds up there before..

severe python
#

Just fyi, this isn't the right channel really, this channel is for help with developing these kinds of extensions (among others) not utilizing them

rich kernel
#

hey guys how do i go about doing this. I have an editor scrip that has a button that runs a function on my grid creation script. In that function it generates an array. How do i make it so that array keeps the data i generate when i enter play mode

severe python
rich kernel
#

yo

humble pond
#

in your editor class you're casting your target to your class and editing the list like normal right? that's not the way to do it 😆

#

you need to work with the serialized properties

rich kernel
#

so i saw a guide where you can call a function from your class in the editor

humble pond
#
var prop = serializedObject.FindProperty("FieldNameHere");```
#

then you can use some awkward methods to alter the array

#

yes you can call, but those won't get saved

#

if you want it to be saved you need to edit the serialized prop

rich kernel
#

basically i just want to be able to create my array and generate my tilemap from the editor and hit play and it still be there

humble pond
#

or you can ask whoever is pressing the button to change something else in the editor so that it wakes up to the changes 😆

rich kernel
#

so in the thing i was watching they made a new class with the [CustomEditor(typeof(myscriptName))]

#

a bunch of stuff you prob understand but essentially i can make a button and call a function on my actual class script

#

in that function the button calls it sets up an array

#

at what part of this process can i edit the property

#

like what am i typing to access it

waxen sandal
#

You can do Undo.RecordObject before you invoke your method

#

Check the docs to be sure

humble pond
#

I had the same issue recently where I altered my class's list from the editor but it wasn't getting saved, because I wasn't modifying the serialized one, I was modifying the temporary editor one

#

if you want to simulate editing the editor, then you need to go via serialized property stuff

rich kernel
#

so im looking at this example for the undo thing and it just goes over my head

#

so i have the target script

humble pond
#

see my code snippet above, declare that in your editor method then you can add/remove/clear the array from the editor with that

#

don't mess with the original class' objects from editor

rich kernel
#

ok im going to have a fiddle see if i can get this working

waxen sandal
#

Your method is only changing one object right?

#

aka itself

rich kernel
#

yeah it just creates an array

waxen sandal
#

If so, then just call Undo.RecordObject(target, "description");

#

Right before your method

rich kernel
#

whats the description for

waxen sandal
#

To fill in

#

It'll show up when you go to Edit > undo

rich kernel
#

what happens if the method changes another object

waxen sandal
#

It won't be recorded

#

And you'll have to call Undo.RecordObject for that object as well

rich kernel
#

i see well it doesnt change anything else but i just wanted to know for future incase it blew something up lol

humble pond
#

oh so that's what I needed back then too 😦 (Undo.RecordObject)

#

hm, do I need to call it before every list.add or field assignment? xD

#

it worked with a single list.Clear() but now it doesn't when I added the rest of the stuff

#

and by not working I mean hitting play loses all changes

oblique hamlet
#

In an AssetPostProcessor, when I update (overwrite) a model, In PostProcessModel, can I get the instances of the gameobjects it will update somehow?

steady crest
#

@oblique hamlet not sure what "model" is in this context, is that a 3d model or smt else?

#

I want my update of my monobehaviour to also run in the editor (probably periodically) to allow a shader to update in the editor. Should I just add an ExecuteInEditor attribute to my Update function or is that a bad idea?

waxen sandal
#

I don't like it but it's probably your best option there

steady crest
waxen sandal
#

Yeah no

steady crest
#

how so?

waxen sandal
#

Because you want it to run per instance

steady crest
#

ah ye, logically

quasi tinsel
#

How can I add my own context menu to add UI Components? I have extended existing UI classes. Would like to be able to right click and add new UI Controls (Perhaps under its own menu) but still requiring a canvas.

visual stag
#

[MenuItem("GameObject/UI/...")]

#

you can see the implementations for the UI components in the MenuOptions class in its package

quasi tinsel
#

That only adds it to the top menu, not to the right click.

[RequireComponent(typeof(CanvasRenderer))]
[AddComponentMenu("UI/Raw Image", 12)]
public class Something : RawImage
#

thanks

visual stag
#

Uh, it adds it to both menus iirc

quasi tinsel
#

Ah it doesn't make a new game object 😦

#

just adds it to the Canvas not as a child

visual stag
#

Sorry, tagged the wrong person before, @whole steppe just to reiterate, LoadAllAssetsAtPath requires a path to an asset, and this is the right channel to ask editor scripting questions

whole steppe
#

oh, forgot this channel was a thing, srry...but yeah; in my code i have that (and a valid folder path) but it returns nothing

visual stag
#

If you wanted to get all the assets under a folder you can use Selection.GetFiltered with SelectionMode.DeepAssets

whole steppe
#

that works, thanks!

silent dawn
#

is there a way to do some actions right before unity sets things up to play the current scene ?

severe python
#

you want to execute code before scene load basically?

silent dawn
#

nah, I want to exec code once I press play but before everything else starts; want to recompile my asset bundles on each play & each build to always be up to date

I tried doing this with an assetpostprocessor but unity will straight-up crash from a segfault if it builds asset bundles while starting up

waxen sandal
#

There's a playmode cahnged event

whole steppe
#

Anyone have some open-source code or way so that in public Vector3 teleportPosition I can have a way to put the world position in the editor via a Gizmo in Scene view?

#

nvm I guess it might be better to specify a gameObject

#

than a Vector3 teleportposition

oblique hamlet
#

@steady crest 3d model

steady crest
#

Uh what? @oblique hamlet

tough cairn
#

im using classic UI for a mobile app , got a vertical scroll view , within it multiple horizontal scroll views , when i try and pull it down to scroll vertically it scroll horizontally

#

seems like the top most scroll view locks them up

#

is there a way to make both scroll views under the touch point to get activated ?

tough cairn
#

nvm solved it

tough cairn
#

@plucky inlet "post"

plucky inlet
#

roflmao and two hours i suppose

tough cairn
#

ur point ?

tough cairn
#

oh lol, my brain lagged for a moment there 😩

#

they say exercise keeps the mind healthy, but i guess power lifting temporary reverses this effect

clear hollow
#

Are there any existing frameworks for doing codegen in Unity? I'm wondering if common problems have already been solved by an open-source solution.

I'm hoping to automate some repetitive coding tasks by using a code generator to spit out logic based on [Attribute]s I put on my classes. For example, initializing Component references, dealing with the repeated if(collider.GetComponent<T>()) logic in OnTrigger, stuff like that.

I have a generator triggered by [DidReloadScripts] that uses reflection and is working well enough.

One problem is that if my generated code has any errors, it brings everything to a halt. Compilation breaks, so reflection breaks, so codegen isn't able to fix the problem that it made.

plucky inlet
#

i would probably go for out of process new roslyn codegen to decouple this from unity build completely
but practically dont have good recommendation

clear hollow
#

Ok thanks, I'll do some research.
I hope roslyn has a way to codegen even when compilation is technically failing, so you can be coding with temporary errors errors and it'll still do its best.

waxen sandal
#

Errors tend to fuck with your IDE so I wouldn't suggest it

steady crest
#

If I have asset references stored in the project settings, they dont get compiled into my build right? or can I pull them from there onto runtime scripts?

oblique hamlet
#

@steady crest I was asking a question, and you answered but I wasn't online- "In an AssetPostProcessor, when I update (overwrite) a 3d model, In PostProcessModel, can I get the instances of the gameobjects it will update somehow?"

waxen sandal
#

Not that I know of @oblique hamlet

#

I doubt it's possible without manually searching every scene/prefab

#

@steady crest Like a settings provider?

oblique hamlet
#

Thanks Navi

steady crest
#

@waxen sandal yes its a settings provider

waxen sandal
#

It depends how you save it, if it's in a SO then that'll get included iirc

steady crest
waxen sandal
#

Sounds like they'll get included

#

Actually 🤔

#

If your SO is defined in a editor namespace and uses editor APIs

#

What would happen then

#

I guess they'd be stripped if they aren't referred

#

And otherwise you'll get an error

#

Since the type can't be found

steady crest
#

it wont build if that happens will it?

#

i mean, its not hard to make a scene reference setup from that SO but it would be nice if i didnt have to

waxen sandal
#

If you refer in your code by the type directly then it definitely won't build

#

Not sure what happens if the SO can't find the type

steady crest
#

I mean I can make a scene object that has an editor script that gathers the data from project settings for the stuff I need

#

not all of it is needed either way, I was just wondering if I could directly reference it

clear hollow
mighty oasis
#

can i use undo with non unity objects?

clear hollow
#

Maybe you could do this if you created a unity object that proxied property access to an underlying non-unity object? So Unity would serialize the unity object into the undo stack, but secretly all those properties were actually write/reading to/from your non-unity object

#

I want to run some background code in the unity editor, compiled into its own assembly, and I don't want it to reload unless that assembly changes.
Is this possible?

Right now it's reloading anytime any code changes, even if the changes are not in that assembly.
I've tried DidReloadScripts and InitializeOnLoad; I'm not sure if one, or the other, or both is best.

harsh hull
#

Does anyone know how to create sub assets inside a newly created ScriptableObject?

// inside ScriptableObject script
    void Awake() {
        var test = ScriptableObject.CreateInstance<TestDO>();
        AssetDatabase.AddObjectToAsset(test, this);
        AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(test));
        AssetDatabase.SaveAssets();
    }

I get an error
AddAssetToSameFile failed because the other asset is not persistent

harsh hull
#

I was able to do it by delaying the AddObjectToAsset until after the asset was named in the project...

    public static async UniTask<T> AddSubAsset<T>(string subAssetName, Object mainAsset) where T : ScriptableObject {
        // wait until asset is created in project
        await UniTask.WaitWhile(() => String.IsNullOrEmpty(AssetDatabase.GetAssetPath(mainAsset)));
        
        // create new subasset
        var subAsset = ScriptableObject.CreateInstance<T>();
        subAsset.name = subAssetName;
        
        // add subasset to parent.
        AssetDatabase.AddObjectToAsset(subAsset, mainAsset);
        
        // refresh project.
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();

        return subAsset;
    }
harsh hull
#

kinda worked.... renaming the file is now wacked. Renaming main asset moves it itself as a subasset and a subasset becomes the main asset 🤔

mighty oasis
#

anyone know how to refresh the project folder after doing a AssetDatabase.AddObjectToAsset() ?

ocean geyser
#

Hello - does anyone know if there's a way (prop drawer?) to show UTF16 in the inspector/editor windows.

#

e.g.

#

this: 🍎 looks like this in any text box

#

(i.e. nothing, even though the unicode for apple is there)

waxen sandal
#

What if you do \U+1F34E

#

Ffs discord

arctic geyser
#

this isn't a question or anything but i just wanted to say i'm super proud of the property drawer i just made

#

it maps a number to an array stored in a different object

#

and it displays the value of the array at that numbered index

arctic geyser
#

changing the number on the right changes the icon next to it, to the icon of the object stored in the array index

snow orchid
#

Hi

shadow lintel
#

Does anyone know why Selection.GetFiltered(typeof(GameObject), SelectionMode.DeepAssets).Cast<GameObject>(); doesn't give any results when selecting a Folder with GameObject assets? Altho it does work the same code if I replace GameObject with Texture in a Texture Folder.

digital spoke
#

Is there a way to remove this button from propertyfields? I've tried a custom drawer but it seems it's baked into PropertyFields themselves.

median kraken
#

How do you make a function to run on edit mode without declaring the whole class as ExecuteInEditMode ???

unkempt surge
#

would it be feasible to extend the Terrain/TerrainLayer classes to enable material support in TerrainLayer instead of being forced to use a texture?

#

i know unreal lets you modify the engine but i'm not a fan of epic

#

something similar to that though

odd vessel
#

how can I get a list of all assets in a project? I tried using AssetDatabase.GetAllAssetPaths, but it seems to returns assets from other packages as well (e.g. com.unity.textmeshpro)

waxen sandal
magic oar
#

ok sorry

waxen sandal
#

This channel is for extending the editor not writing game code

magic oar
#

ok ok

limpid linden
#

Does anyone know how to access the Scene Window toolbar to lets say add your own buttons? I assume it's through reflection, but I've not had a deep dive into the Scene Window source yet

#

Unless I'm that blind and it's right in front of me without knowing

#

This is what I mean by the way (just in case anyone didn't get what I meant)

waxen sandal
#

Perhaps UIElements give you easy access

#

But I'm not sure if the scene view is rewritten yet

limpid linden
#

there's only two events for SceneView currently, and it's just beforeGUI and afterGUI, but neither draw to that toolbar
I assume I'm gonna have to use reflection, which in that case I'll ignore it and make some form of toggle GUI in the scene view directly

waxen sandal
#

Right

#

But if the SceneView is UIElements you can just find the window, get the root element, then find the toolbar and add or remove w/e you want

limpid linden
#

Nah SceneView is EditorWindow

#

or well Searchable*

waxen sandal
#

You can draw the content of your window with either IMGUI or UIElements

#

So it's an EditorWindow, yes but that's because everything is a EditorWindow

limpid linden
#

I find it kind of yikes that it's not just a general toolbar with a callback for additional draw

#

But yeah you're right

#

heck it, it's not worth tryna calculate positioning to draw on to it

odd vessel
#

I have created custom editor for my component with a button (in the properties window) that creates children based on a property.
The problem is I have a GameObject with said component inside prefab, and I can't create children because of it.
Any ideas?

real ivy
#

Im not sure why this doesn't work.
Accessing SerializedProperty.arraySize gives nullRef, even tho i already FindProperty a list and all that..

#

Ohmy god. What a stupid bug/mistake

I used List<> but apparently VS automatically fetched from Boo. namespace... which is the wrong one...

stark geyser
real ivy
#

Thanks 😄 Will be helpful

real ivy
#

Im doing as per the docs

AssetDatabase.AddObjectToAsset(newAsset, skill);
// Reimport the asset after adding an object.
// Otherwise the change only shows up when saving the project
                AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(newAsset));
skill.apply.Add(newAsset);
AssetDatabase.Refresh();

But the child SO still doesnt show up until i click another folder and come back to it
What's the most sure way to make it showup immediately?
edit: actually even "saving" doesnt make it showup (as claimed)
Even added
EditorUtility.SetDirty(skill);
AssetDatabase.SaveAssets(); and still not doing it

real ivy
#

Im trying to do a nested SO list, which i know works
But im doing it like this

public class ContainerSO : SO
{
List<NormalClassContainer> classContainer;
}

public class NormalClassContainer
{
List<ClassSO> listSO;
}

Then somewhere in editor script:

SerializedProperty myListRef = weaponVariance.GetArrayElementAtIndex(i);
SerializedProperty myWeaponType = myListRef.FindPropertyRelative("listSO");
EditorGUILayout.PropertyField(myWeaponType, new GUIContent("Weapon Types"));

It throws ArgumentException: Field type defined on type WeaponVariance is not a field on the target object which is of type ActiveSkill. on the last line

real ivy
#

Aaa nevermind

stark geyser
#

@real ivy I think you can't access it because it's not serialized.

real ivy
#

No its serializable and all that

#

But it works now

visual stag
#

does it actually look like that tiny screenshot O.o

real ivy
#

Yes, and it works

#

Basically trying to mix that enum mask, this thread
https://forum.unity.com/threads/display-a-list-class-with-a-custom-editor-script.227847/
and this thread
http://antondoe.blogspot.com/2016/08/serialization-with-polymorphism-and.html

to make my omega event basedskill system drawer!

#

(Im quite a beginner in custom editor, all i can do is leech 😦 but hey it works!)

visual stag
#

it looks like the normal one but it properly displays a list of the values

#

instead of just saying Mixed

#

it may or may not require some other stuff in my rando package 😉

real ivy
#

Nice collection
I think i came across that a few times before

visual stag
#

I really need to split it all up and clean it up so it's more appealing haha

#

remove the stuff that's no longer maintained

real ivy
#

Btw i havent tried the new UIElements but with that around, does it change anything to custom editors? Anything became obsolete or just not preferred?

#

(I may not know what i'm talking about...)

visual stag
#

It changes a lot, but I only use it when I can be bothered

#

it's more tedious

#

(for me at least)

real ivy
#

Can i safely assume UIElements is more for cosmetics?

visual stag
#

What do you mean?

#

You can make 80% of what you can now using it

#

and for that 20% you can use an IMGUI Container

real ivy
#

Compared to custom editors (which has a lot to do with serializiation etc), ui elements is like just the css part of web dev, to compare (which has nothing to do with the actual content like html/php)

visual stag
#

it's entirely about GUI

#

though it restructures about how you think about writing GUI code

#

as it's stateful

severe cliff
#

One cool thing about UIElements is u can use UIBuilder to help u build ur UI

#

I used it yesterday, it is a godsend superb system

#

Tho currently it only works for editor UIs only

real ivy
#

How do i do this EditorGUILayout.PropertyField(myWeaponType); in UIElements?

The property is a special enum. In CustomEditor, using EditorGUILayout.EnumPopup doesnt work, and PropertyField works
Likewise, in UIElements, EnumField doesnt work, so something equivalent to PropertyField maybe works?

#

And how does it look like in the uxml side?

waxen sandal
#

There's a PropertyField element as well, not sure what the syntax is

#

There's a bunch of examples on github

real ivy
#

Well not exactly, as im not using static editor flags, but im getting the error and im using PropertyField in uxml. This issue is the closest to it..

#

I get that error when the property is a normal enum

When i do the EnumMask attribute to it (making it the special enum), it crashes unity everytime the inspector is inspected...

real ivy
#

Im stuck in var inspector = new InspectorElement(target);
Does UIElement work on its own custom editor script?
I do this in

[CustomEditor(typeof(ActiveSkill))]
public class ActiveSkillEditor : Editor```
Where ActiveSkill is just an empty SO.
But im getting StackOverflow
waxen sandal
#

Why are you creating a new inspectorelement..?

#

You're registering your editor as an editor for the ActiveSkill type

#

Then you create a new inspector for your target

#

Which then goes and finds the editor that is registered for ActiveSkill or a generic fallback

#

Which then in turn creates a new inspector for same target

real ivy
#

Thanks. I need to sleep now but tmorrow ill continue a bit more fresh

clear hollow
#

Noob question: I have my project split up with asmdefs. How do I tell an assembly to be excluded from Builds, the same way as an Editor folder?

#

Figured it out; had to add a UNITY_EDITOR constraint.

Follow-up: is there a way to make an assembly reference the predefined assembly? My code's in an assembly, but I have third-party code that I can't easily put into an assembly. So I need my code's assembly to reference the predefined Assembly-Csharp.dll

severe python
#

see: Backwards compatibility and implicit dependencies
on the page you linked

clear hollow
#

Thanks!

You cannot declare explicit references for the precompiled assemblies.
Did they mean to say "predefined assemblies" instead of "precompiled assemblies?" A bit confusing because they have "predefined assemblies" which are Assembly-Csharp and Assembly-Csharp-Editor, but they also have "precompiled assemblies" which are third-party plugins.

severe python
#

they mean like an assembly you download from the internet and put in your project

digital spoke
#

Can I get help on changing the cursor via custom inspector? I'm trying to make it so the cursor changes after you click a button in the inspector but I can't seem to actually change the cursor when it's inside the scene view.

    private void OnSceneGUI()
    {
        e = Event.current;
        //Picking is set to true when the user clicks the button. I've checked and yes, it is true whe I test it.
        if (picking)
        {
            //I've tried the AddCursorRect method but that only works as long as the cursor is within the bounds of the inspector GUI.
            GUI.DrawTexture(new Rect(e.mousePosition.x, e.mousePosition.y, 24, 24), Resources.Load<Texture>("Sprites/icons/small/EyeDropper")); //Nothing shows up. 
        }
    }
midnight viper
#

Does anyone know of a way to add an option to the kebab menu for a specific editor window ?

real ivy
#

Yeaaay it works in UIE ! Thx @waxen sandal sry for the ultra noob problems
Default Index is beyond the scope of possible value this is caused bcoz i didnt put a None = 0 element for my enum

And the last puzzle piece is whether UIE can handle polymorphic SO...

clear hollow
#

they mean like an assembly you download from the internet and put in your project
@severe python
That's the problem; I don't think they meant that. It seems like a typo, and they meant to say "predefined assembly" because that matches what they're describing and the diagram

real ivy
#

Help..
I cant click on my enum pop up

    public override VisualElement CreateInspectorGUI()
    {
        SkillApply addApply = SkillApply.Damage;
        EnumField enumAddPlanet = rootElement.Query<EnumField>("enumAdd").First();
        enumAddPlanet.RegisterValueChangedCallback((t) => {
            //addApply = t.newValue;
            Debug.Log("Selected add: " + addApply);
            AddPlanet(addApply);
        });
        return rootElement;
#

And how do i apply t.newValue? Should i just cast it?

real ivy
real ivy
#

How to check if a UIElement field is focused?

steady crest
#

Is it possible to filter the object selector serialized field for a TextAsset file to only look for files with a specific extension?

waxen sandal
#

If you make your own

#

Otherwise just do it in a on change check

#

And show a notification if it fails

steady crest
#

its more about the selector showing all the script files because it indetifies them as text

waxen sandal
#

Then you need to write your own window

steady crest
#

yikes

#

should I make a custom search window for certain assets? or just write to the project window and fill it into the search bar?

#

the first is probably cleaner

waxen sandal
#

the first

#

I've made something like that before

steady crest
#

that doesnt exist in unity yet tho?

#

you can search with terms, not extensions?

waxen sandal
#

Yeah you gotta make your own filtering

steady crest
#

its not that hard tbh. just itterate a list based on the directory namespace

waxen sandal
#

Should use the assetdatabase but yeah

#

With keybaord navigation, double clicking, tree view, search

steady crest
#

tho having an editor window for quick access to everything might be nice, as well for items 🤔 so i can quickly add them to the player or invoke their effect for testing

#

@waxen sandal

waxen sandal
#

Doesn't Odin have that?

steady crest
#

there is probably a thingy for it

#

i most likely just dont know the name

onyx harness
#

tho having an editor window for quick access to everything might be nice, as well for items 🤔 so i can quickly add them to the player or invoke their effect for testing
@steady crest you mean Unity QuickSearch?

#

Like Hąste

#

Ou Spotlight

waxen sandal
#

He means like the objectpicker but for specific type + extensions etc...

steady crest
#

lol

onyx harness
#

I can drop you some code

steady crest
#

I have a picker for textasset, but its also got cs files selectable. which I wanted to avoid

onyx harness
#

To make a small search window

waxen sandal
#

I've only got one for types

#

I think I have one for objects as well somewhere

#

But I don't remember where

steady crest
#

I could solve it with Odin like this tho
[SerializeField, FilePath(Extensions = "xml", ParentFolder = "Assets/NPC/Data")] private string npcDataPath;

waxen sandal
#

Oh nvm I found it

#

It's in a private repo though 😦

steady crest
#

it opens a windows selector which only allows xml files to be selected

#

tho a generic editor searching window might not be bad, have a nice grid for items on it too with a generic menu to perform some actions on edit mode debugging 🤔

#

@onyx harness what is this code you speak of to make a search window?

onyx harness
#

I got a generic purpose window search

#

On which I implement my more specific needs

#

Like files, Types, Objects etc.

steady crest
#

interesting, that sounds exactly like what i would need (to make)

onyx harness
#

But it's a bit big

steady crest
#

define big

#

xD

waxen sandal
#

It's made for Unity 2017 though

onyx harness
#

Few files

waxen sandal
#

So it might be a bit outdated

#

The filter is the same as the search in the assetdatabase

steady crest
#

aha, those filters dont allow extensions tho, which is what im looking for

waxen sandal
#

You can easily extend it 😛

steady crest
#

I could even make it a propertydrawer 🤔

waxen sandal
#

Oh yeah I have that as well

steady crest
#

oh wow

waxen sandal
#

I think the styling is subpar though

#

But it does work

steady crest
#

I like how its called bodybuilder

#

the namespace

waxen sandal
#

Not my choice 😛

steady crest
#

lol

waxen sandal
#
    public class ObjectPickerAttribute : PropertyAttribute
    {
        public string filter;
        public string[] folders;

        public ObjectPickerAttribute(string filter, params string[] folders)
        {
            this.filter = filter;
            this.folders = folders;
        }
    }```
steady crest
#

I do wonder, why are you using regular gui and not the layout stuff?

waxen sandal
#

It's a propertydrawer

steady crest
#

dumb question

waxen sandal
#

So you should use regular gui

#

Yes indeed

steady crest
#

I also just found some weird construct I made a while back

#
        public static GenericMenu CreateGenericMenu(params Tuple<bool, string, UnityAction>[] OnClick)
        {
            GenericMenu currentMenu = new GenericMenu();
            foreach (var keyValuePair in OnClick)
            {
                if (keyValuePair.Item1 == EditorApplication.isPlaying)
                {
                    if (keyValuePair.Item2 != string.Empty)
                    {
                        currentMenu.AddItem(new GUIContent(keyValuePair.Item2), false, keyValuePair.Item3.Invoke);
                    }
                    else
                    {
                        keyValuePair.Item3.Invoke();
                    }
                }
            }

            if (currentMenu.GetItemCount() != 0)
            {
                currentMenu.ShowAsContext();
                Event.current.Use();
            }

            return currentMenu;
        }
#

im not sure why I made this lol

#

thx for that code! I'm reading it through. I'll see if it needs updating 🙂

onyx harness
steady crest
#

that is indeed uh

#

quite long

onyx harness
#

It's a lot of stuff. They all rely on my own tools, that's why it won't compile

steady crest
#

thats a lot of code. im gonna skim through it and learn some stuff! lol

onyx harness
#

But at the end, I got this

steady crest
#

faaaaancy

#

do you just make exclusively editor tools or smt?

steady crest
#

im hesitant to actually spend a lot of time developing tools for the store... cuz i would need to update and support them and thats kinda idk 😦

waxen sandal
#

That's why I don't 😛

#

I just get myself hired at a place where I write tooling most of the time

steady crest
#

I am currently writing tools to lower the workload on my artist for our game while he is working on the story 🙂

#

I alrdy made a level editor, which is also why i want a editor window with mesh previews. but thats a WIP

onyx harness
#

I learn while doing my hobby

#

that's not a hassle for me 🙂

#

I dropped in the gist, EnumSelector, StringSelector, TypeSelector

#

StringSelector is the one you want for your "files filtering"

steady crest
#

im reading through it right now! 🙂

waxen sandal
#

Mikilo's is probably better than mine 😛

steady crest
#

more advanced*

hard fractal
#

is my visual studio api working properly? i pressed control alt m and control h

waxen sandal
#

What

steady crest
#

huh?

waxen sandal
#

Just go to the website

#

Also this is not the channel to ask about issues with IDEs

hard fractal
#

ok

#

what channel would that be=

waxen sandal
hard fractal
#

ok im just asking because i dont know anything about unity api, so i wanted a quick way to check out libraries and stuff

steady crest
#

yeh, but you are running the unity documentation inside visual studio... thats just weird

hard fractal
#

im new to this, so i wouldnt know that! thanks

waxen sandal
#

Embedded browsers tend to be shit

#

So it's best to just use your normal browser

#

I wouldn't even know how to get the embedded browser to open in vs

steady crest
#

im guessing its some sort of extension tbh

waxen sandal
#

Nah

#

I think it's integrated

steady crest
#

what a useless feature tho...

#

feels like bloat to me.

hard fractal
#

so if i wanted to check out what this class does for example? what do i do?

waxen sandal
#

Well that's not something from Unity

#

So you'd just browse to where that is defined in your code

#

ctrl+click does that

hard fractal
#

oh

steady crest
#

im still looking for the shortcut in rider for that xD

hard fractal
#

what about stuff native to unity, stuff implemented by using UnityEngine:

waxen sandal
#

ctrl+b

#

or ctrl+click

steady crest
#

I was looking through the right click menu just being confused

waxen sandal
#

I usually just google Unity classname

hard fractal
#

that makes sense

steady crest
#

cant yuo press f1 on unity classes to get the documentation in VS?

#

Rider throws it into a google search, idk about VS

hard fractal
#

vs has that installer thingie

#

and inside that you can install a unity package with documentation

#

just looking for a way to access it

#

google is cool, but i have one monitor so sometimes it gets messy

split bridge
#

f12 in VS? shift+f12 to find refs?

hard fractal
#

can you tell me a random unity keyword to test it out?

#

thats how much i know

onyx harness
#

MonoBehaviour

split bridge
#

though if you go to class definition of MonoBehaviour you won't see anything useful 🙂

plucky inlet
#

they're talking about something else - F12 is symbol definition / reference

#

in-project refactoring support

#

i don't think ms docs are tied to unity documentation no

split bridge
#

ah.. looking for docs? I see

plucky inlet
#

though it might redirect some stuff to unity website if VSTU are isntalled

hard fractal
#

yeah i installed that

plucky inlet
#

you might be getting something by pressing F1 on a symbol
generic MSDN page most likely D

steady crest
#

oh wow I found this https://www.youtube.com/watch?v=erWEG-6hx7g#:~:text=now there are two classes,simple as it could be.
@onyx harness I think this is what I need exactly lol

Creating custom inspectors in Unity can be difficult and time consuming. Odin Inspector make it easy to add custom editor windows to your project with just a few lines of code. This video looks at creating an editor to create and manage scriptable objects.

Video Files (Githu...

▶ Play video
onyx harness
#

Looks like good stuff

#

But for that, you need Odin

steady crest
#

I own odin so 🙂

onyx harness
#

that's funny, in the video, the skin is square

steady crest
#

Im actually curious what is done with the propertydrawers from Odin and "unused" functions as a result of it.

#

propertydrawers are just not included in the build I assume. what about unused functions? what happens to those when you build?

waxen sandal
#

They're probably all in the editor namespace so it won't do much on build

#

And they're not stripped usually

#

IIRC there are options for it

onyx harness
#

They are if the options are set

#

And since we are usually talking about IL2CPP

#

They are by default

waxen sandal
#

Not in editor

onyx harness
#

isn't he talking about a build?

steady crest
#

im referring to a compiled runtime

#

because the stuff Odin uses is in the actual cs file, not an editor for it

#

since its all propertydrawers

#

for the editor it doesnt rly bother me that there are unused functions tbh

onyx harness
#

I'm not sure to understand your question/statement

steady crest
#

im just kinda wondering about a situation like this, what remains after the executable is built

[OnValueChanged("change")] public string t;
void change() {}
#

is it just the string? or does it remove its reflected function as well? or does it not matter at all?

waxen sandal
#

Those keep exciting unless you enable code stripping

#

Your attribute probably keeps existing as well

#

Perhaps if there is a conditional attribute on it might get stripped, not sure

steady crest
#

I should probably not be asking that here, but on their discord

onyx harness
#

Attribute is most likely to stay

#

The method will be stripped

#

As no one is referencing it

steady crest
#

the attribute is in the editor namespace tho? or you mean the attribute reference?

waxen sandal
#

The attribute isn't in the editor namespace

steady crest
#

oh

waxen sandal
#

Otherwise you wouldn't be able to use it

onyx harness
#

If the attribute was in the editor world, you won't be able to build

steady crest
#

oh yeah right

onyx harness
#

The only way would be to wrap it between UNITY_EDITOR

steady crest
#

that sounds like a nightmare to do for everything

#

and probably not worth the effort

onyx harness
#

Just dont, not worth it

steady crest
#

ooh thx 😄

onyx harness
#

Do you know about sabresaurus?

steady crest
#

I dont, and the only thing google is showing me is yugioh cards

onyx harness
#

This one

#

Widely used by dev, to check the range of versions an API is available

steady crest
#

oh, so yu can see what is available for which version

#

interesting

#

my compile times on this laptop are literally making me cry btw

#

cant wait to leave work and get my home pc compiling my editor code

onyx harness
#

Use more AsmDef maybe

onyx harness
#

oh, so yu can see what is available for which version
@steady crest Yep, very convenient.
And from this idea, I wrote NG Unity Versioner, which is local, and much more powerful, since I don't just check one single API, but a whole codebase.
Also, I can check private/internal stuff, which Sabresaurus don't

steady crest
#

2.3Ghz processor. its abysmal

#

and thats actually smt I might use xD

onyx harness
#

For people doing Reflection/digging stuff, this is a gem.
I made it as an exercise to learn MonoCecil, ended up using it frequently

steady crest
#

it does sound like a headache prevention

severe python
#

I need to use that

waxen sandal
#

cecil?

severe python
#

the api thing

queen violet
#

What's the best tool for quickly creating compound collider or mesh collider for complex meshes?

torn zephyr
red falcon
#

@torn zephyr have you tried calling base.OnInspetorGUI() at the start?

torn zephyr
#

No, will do

#

You mean at the beginning of OnInspectorGUI?

#

Still draws the new editors inside 😦

red falcon
#

thats what I meant :/

torn zephyr
#

It draws it inside in addition to below. Not sure what you mean

marsh pollen
#

anyone familiar with UMA2?

waxen sandal
#

Idk what UMA2 is, if it's an asset then this is the wrong channel

#

And I've got no idea what you're even trying to do

steady crest
#

How do I access the Results? I have the selected values object but I have little idea where to go from there

#

I want the name of the selected field so I can figure out what the user has selected

waxen sandal
#

Isn't Results the values of a collection?

#

So yuo should just be able to iterate over it

steady crest
#

its the <>4__this thats confusing me

waxen sandal
#

It's a generic

steady crest
#

I dont remember how to do that, damn. gonna google

#

I forgot how to use an enumerator somehow

#

I fkn hate this laptop...

waxen sandal
#

Just do .foreach on it

#

In Rider

steady crest
#

I will once its done compiling, so in like 5 minutes

#

Why does rider need to initialize the debugger every time tho... its locking up my editor constantly

real ivy
#

I cant seem to... make my ListView have height other than 0. Anyone have an idea?

waxen sandal
#

There's examples on github on how to use it iirc

real ivy
#

Im using that, and it does the 0 height thing

waxen sandal
#

0.o weird

#

Twiner might know more, I haven't done much with UIElements

real ivy
#

So if i

ListView damagePropField = new ListView(damageOut, 100, makeItem, bindItem);
damagePropField.style.minHeight = 100;
ret.Add(damagePropField);

The pic happens
The makeItem among others makes a button, which is that square white button on the left that's behind the text "Enum Add Popup"
ret is VisualElement of the darker box. So it just doesnt stretch and... not "in" the box to begin with

And first of all, something shows up only bcoz i set style.minHeight, otherwise height will just be 0

damageOut is just List<string> btw

kind linden
#

When I try: PrefabUtility.UnpackPrefabInstance(newObject0GO, PrefabUnpackMode.OutermostRoot, InteractionMode.AutomatedAction);

#

I then tried: var thePrefabInstance = PrefabUtility.InstantiatePrefab(baseGameObject); PrefabUtility.UnpackPrefabInstance(thePrefabInstance, PrefabUnpackMode.OutermostRoot, InteractionMode.AutomatedAction);

#

And I get: Argument 1: cannot convert from 'UnityEngine.Object' to 'UnityEngine.GameObject' [Assembly-CSharp]csharp(CS1503)

#

I really need some hep with this there are no examples to work with in the api and almost nothing is found when searching the web.

short tiger
#

Is baseGameObject of the type GameObject or Object?

#

According to the error, it's an Object, when it should be a GameObject

kind linden
#

baseGameObject is a GameObject

short tiger
#

Try replacing the line with:

var thePrefabInstance = PrefabUtility.InstantiatePrefab(baseGameObject as GameObject);
kind linden
#

what is a prefab instance?

#

it doesn't seem to be an game object nor and object

#

the problem is in this line: PrefabUtility.UnpackPrefabInstance(thePrefabInstance, PrefabUnpackMode.OutermostRoot, InteractionMode.AutomatedAction);

onyx harness
#

it is a GameObject

kind linden
#

when I do this: GameObject thePrefabInstance = PrefabUtility.InstantiatePrefab(baseGameObject as GameObject); I get: Cannot implicitly convert type 'UnityEngine.Object' to 'UnityEngine.GameObject'. An explicit conversion exists (are you missing a cast?) [Assembly-CSharp]csharp(CS0266)

onyx harness
#

A prefab is a GameObject model.
An instance is an actual working copy of its prefab.

#

And obviously, a GameObject is an Object.

#

Because PrefabUtility.InstantiatePrefab returns an Object. You forgot to cast it.

kind linden
#

when I do: var thePrefabInstance = PrefabUtility.InstantiatePrefab(baseGameObject as GameObject); PrefabUtility.UnpackPrefabInstance(thePrefabInstance, PrefabUnpackMode.OutermostRoot, InteractionMode.AutomatedAction); I get: Argument 1: cannot convert from 'UnityEngine.Object' to 'UnityEngine.GameObject' [Assembly-CSharp]csharp(CS1503) in the 2nd line

#

isn't thePrefabInstance the cast?

onyx harness
#

Because you forgot to cast

#

you used var

#

Dont use var

kind linden
#

well there is no Object variable

onyx harness
#

You actual var is an Object

#

And not a GameObject

short tiger
#

thePrefabInstance is an Object because that's what InstantiatePrefab returns

#

public static Object InstantiatePrefab(Object assetComponentOrGameObject);

kind linden
#

so public static Object thePrefabInstance = PrefabUtility.InstantiatePrefab(baseGameObject as GameObject);?

short tiger
#

I was just showing you the definition of the method

kind linden
#

oh ok

short tiger
#

Not how you would call it

kind linden
#

I still don't understand how to call it tho

short tiger
#

UnpackPrefabInstance is expecting a GameObject

#

You are giving it an Object (which is actually a GameObject, but the compiler doesn't know that)

#

So you need to cast the Object you get from InstantiatePrefab into a GameObject

#

Before you pass it into UnpackPrefabInstance

kind linden
short tiger
#

And what type is baseGameObject?

kind linden
#

GameObject of course

short tiger
#

You say it's GameObject, but you define it as var baseGameObject

#

Which means it will be whatever type the compiler figures it is

kind linden
#

nope it is a public GameObject baseGameObject;

#

the var was in front of the thePrefabInstance

short tiger
#

And what have you assigned to baseGameObject?

kind linden
#

I drag and dropped the prefab into it via inspector

short tiger
#

If you just need to copy paste an asset, you can use AssetDatabase.CopyAsset where you pass in the asset path of the original prefab and the new path

#

AssetDatabase contains methods to get the asset path of a given asset instance

kind linden
#

I want to duplicate a prefab so it has no attachments to the original

#

like d&d into a scene then unpacking it and then d&d the unpacked version into the project folder

short tiger
#

I don't see why duplicating the asset wouldn't do that

#

I don't think it will create a variant

kind linden
#

then ctrl + d should do that too sec

#

wtf ok it works again

#

for some reason ctrl+d didn't duplicate right

#

works now though

#

I still would like to understand how to use PrefabUtility.UnpackPrefabInstance tho

#

this is the 3rd time I tried to get it to work and I still can't

#

So is unity bugging out with PrefabUtility.UnpackPrefabInstance or is it my inability to understand how it works?

short tiger
#

Well, it seemed like you were trying to unpack a prefab asset, not an instantiated prefab

#

Unless baseGameObject was referencing a scene game object

kind linden
#

no it wasn't in scene, was that the problem that the prefab isn't in scene?

short tiger
#

UnpackPrefabInstance means unpacking a game object in some scene so that it's no longer connected to whatever prefab it's an instance of

#

You can't unpack a prefab asset in the project

kind linden
#

ahh ok I thought that since they have their own scene when I open them up that that would work

#

thx then I understand what's wrong at least but man unity is stressing me today with bugs

wraith crane
short tiger
#

How are you expecting that to work though? Would it draw both inspectors one after the other?

#

Somehow merge them?

wraith crane
#

One after the other, this is a simplified version of what I'm trying to do

onyx harness
#

The best move would be to totally avoid Editor

#

But that's just my opinion...

wraith crane
#

What should I use instead?

onyx harness
#

PropertyDrawer

#

Editor is for class

#

PropertyDrawer is for members of the class

#

The first is okayish, do its job

wraith crane
#

Ah ok, I've already used it in other parts of the project.. Maybe I should try using the property drawer

onyx harness
#

The second is reusable, maintainable

#

A lot of people use Editor while PropertyDrawer is clearly the best way

#

I implemented a shitton of tools/editor stuff, I almost never used Editor

severe python
#

you could force this to work wtih editors, but it will be janky and it will duplicate fields

wraith crane
#

Can I create something like an attribute for a function and then use a property drawer to draw the return value of the function? Something like:

[Preview]
public float MyFunc()
{
      return 6;
}

Something like [Context menu("Menu")]

#

In a ScriptableObject

onyx harness
#

This thing might be heavy

#

But you can find many resources about calling a method from the Inspector

real ivy
#

Hi all. Im back with the next problem with ListView

So if i understand, makeItem and bindItem is called while u scroll down (and it generates more elements)
I have a ListView, each has a button to RemoveAt, and a button outside of list to Add. Pretty standard

They work, but if i have more elements that i need to scroll down, the button is called twice.

Say the scroll view can only fit 2. If i make 4 buttons, then scroll to most bottom, pressing button 3 will delete element 2 and 3 (in that order)

#

Then, if i have 5 buttons, pressing button 5 will RemoveAt 0 and 4 (the RemoveAt(4) also causes IndexOutOfRange, expectedly so, bcoz 0 is removed and therefore index 4 becomes invalid)

wraith crane
#

But you can find many resources about calling a method from the Inspector
@onyx harness the best way to pass variable as parameters in an attribute is to pass the name (string) and then use reflection to get the value?

onyx harness
#

Yes

#

@wraith crane Anything in an Attribute must be constant.

#

Pass the name of a method, or use nameof()

wraith crane
#

Thanks!!!

steady crest
#

can I enforce a unityevent to preset it to a certain object?

onyx harness
#

Using Reset()?

wraith crane
#

Pass the name of a method, or use nameof()
@onyx harness can't I just get the name of the "marked" property (the function) in some ways?

steady crest
#

Using Reset()?
@onyx harness how tho? it wont show in the editor will it?

onyx harness
#

@steady crest Oh I thought you were talking in a MB context

#

@wraith crane I guess yes

steady crest
#

trying to assign an object and lock it so you can only change the functions

onyx harness
#

From an Editor?

steady crest
#

aye

onyx harness
#

if the Object is never changing

#

Why are you even using a UnityEvent?

steady crest
#

assigning functions in the editro

#

making a state machine to put it in context @onyx harness

onyx harness
#

But the Editor is relying on an Object

#

Which type of Object are you working on?

#

SO? GO?

steady crest
#

SO

#

SO has the script, I wanna enforce it only to pick from the functions I provide on that object

#

well, in the SO script to be precise

onyx harness
#

You provide?

#

Available you mean?

steady crest
#

I provide that SO with the functions on it. and I want to only make those functions available

#

so I wanna preset the object into the method selector

onyx harness
#

Well you have Awake() in your SO that you can use

#

or OnEnable()

wraith crane
#

Does anyone know how to put an attribute on a method?
Because I have created the property attribute class and the property drawer class, but OnGUI of the property drawer is never called (because the method can't be drawn?)

How does [ContextMenu] work?

onyx harness
#

PropertyAttribute is only on field

wraith crane
#

What is ContextMenu?

wraith crane
#

Isn't context menu a property attribute?

onyx harness
#

An Attribute

wraith crane
#

There's no built-in function that gets called for an attribute every frame? I have to create a class that manually searches all the methods in all the classes that are marked by the attribute using reflection?

onyx harness
#

InitializeOnLoad

wraith crane
#

Ok ty

queen violet
#

Is there anything available that will add mesh colliders for all meshes in an fbx and hides or removes the mesh renderer

real ivy
#

Hi all. I have CustomEditor for some ScriptableObject. In this SO, there's a c# class, that i can change the member values. But the values dont save when recompiling scripts.
What's the equivalent of serializedObject.ApplyModifiedProperties() for normal c#?

waxen sandal
#

Can you share some code?

real ivy
#
FloatField numField = new FloatField();
numField.RegisterValueChangedCallback((t) =>
{
    num = t.newValue;
}

I'm using UIElements, and the value changes are there. The saving values should be a common thing tho

#

num is inside the normal c# class, which is in this SO

waxen sandal
#

Well, you need to make sure it's all serialized properly

#

And then you can either create a SerializedObject from the parent SO and use FindProperty to find the specific value

#

Or you can use Undo.RecordObject or EditorUtility.SetDirty on the SO

tidal pike
#

Does anyone know why my reflection only returns one attribute every time?

           System.Attribute[] attributes = Attribute.GetCustomAttributes(type);
            foreach (var attr in attributes)
            {
                Debug.Log("Found attribute");
            }```
waxen sandal
#

But then you'd need to handle undo support yourself

tidal pike
#

My attribute classes are basically as basic as you can get

#

    [AttributeUsage(AttributeTargets.Field)]
    public class OutputAttribute : Attribute
    {
        public bool ShowValue;
        public Port.Capacity Capacity;

        public OutputAttribute(Port.Capacity capacity = Port.Capacity.Multi, bool showValue = true)
        {
            this.ShowValue = showValue;
            this.Capacity = capacity;
        }
    }```
#
            System.Object[] attrs = type.GetCustomAttributes(typeof(InputAttribute),false);
            Debug.Log(attrs.Length);```

this just gives me 0
wraith crane
#

Can I draw in the inspector outside an Editor/PropertyDrawer/... class? If yes, how can I say in which position to draw what I want?

waxen sandal
#

You can get the root UI element and add w/e you want wherever you want

wraith crane
#

How can I get the root UI element? (What do you mean by root UI element?)

#

The MonoBehaviour script?

waxen sandal
#

All EditorWindows ahve a root VisualElement, so if you find the window (you can use Resources.FindObjectsOfTypeAll) then you can just add things

wraith crane
#

Ok ty

#

With the root visual element of the inspector do I have to draw the things "manually" or can I access something like EditorGUI functions?

Because if I have to draw things in my MonoBehaviour I want to draw them on a blank space, I don't want to draw things on top of other things

(I am searching in the documentation how it works, but I can't find what I need)

waxen sandal
#

It sounds like you just want a custom editor and not some other way to draw in the inspector

#

And you should look up how UIElements works

wraith crane
#

Ok, I'll search on yt how UIElements works (I can't use a custom editor, I need to draw an attribute that is used by functions)

waxen sandal
#

??

wraith crane
#

I have an attribute [Preview] and I want to mark methods with this attribute. Then I want to draw things in the inspector based on the return value of the method marked as [Preview]

waxen sandal
#

You can still do that in CustomEditors, but you either have to overwrite all editors for monobehaviours or extend all your scripts from your own base class

#

That's probably a lot easier than trying to match a UIElement to an instance of a component

wraith crane
#

If I use a custom editor for UnityEngine.Object (basically for everything) then can I still use other custom editors for the classes?

Because previously I had some problems with 2 custom editors trying to draw the same thing.. only the second one was drawing the editor

tulip plank
#

Whenever I try to cache the current value of style properties (UIElements), the value gets set to null. Is there something intentionally preventing people from caching these values?

real ivy
#

Hmm. Still cant manage to properly save normal c# class

I have a ScriptableObject, made custom editor for it.
This SO has List<A>, A is a normal c# class. This A gets saved properly
Inside A there's also List<B>. Added this via the custom editor stuff, made sure the instance is really there (debug log the actual SOinstance.list.list.count), and it really is there

The way List<B> gets added is the same as List<A> (didnt even call ApplyModifiedProperty).
But List<B> just disappears when recompiling!
What's happening?

#

Ok n then figured it out.
It's bcoz class B is abstract (List<B> contains different derived class) and unity just can't handle subclass (unless it's Unity.Object)

#

My super skill system's custom inspector will need to use many small class B : SO to be saved as SubAsset... but i guess it has to be done..

wraith crane
#

In a custom editor, if I use property.nextVisible() it also gives me built-in properties that should not be visible (like in UnityEvents "m_persistentCalls", "m_calls"...)

#

How can I check if the property should be visible?

waxen sandal
#

You don't, Unity has written a custom editor for those things where they decided manually which to show

#

This is why you don't want to write a custom editor for all Object types

wraith crane
#

Can I check in some ways where a method info is inside a class? Basically I need to check if a method info is before or after a FieldInfo

waxen sandal
#

Afaik there is no guaranteed order

wraith crane
#

Afaik there is no guaranteed order
@waxen sandal ok thanks (well I would like to have the same order as the SerializedProperty.Next() function but ok)

waxen sandal
#

Yeah there's no way to guarantee that those will be the same, you can find all serializedproperties and then try to find the matching property/method/field or w/e

real ivy
#

Is there a way to find the "parent containing" .asset of a subasset?

waxen sandal
#

Eh the object not the path to the main asset

real ivy
#

So..
ScriptableObject so = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GetAssetPath(applyDef)) as ScriptableObject;
(Where applyDef is my some subasset of some parent SO)
?

#

So a subasset's path and that subasset's parent asset's path should be the same?

unkempt fern
wraith crane
#

If I want to use my editor with scriptable object it doesn't work very well..

If I use target.GetType() it gives me "AssetImporter" instead of the type of the ScriptableObject

#

(I've solved with a simple trick)

split bridge
#

@unkempt fern probably not the right channel to ask and I've never used that property - that said, I would guess it's for modifying the clickable/touchable area for an image - for example if you had a small button but wanted the interactable region to be larger than the image

#

@real ivy yea that's correct - they have the same path

unkempt fern
#

@split bridge ok thanks

wraith crane
#

Can I get FieldInfo from SerializedProperty? I've tried in some ways, but it only works if the serialized property is an UnityEngine.Object..

#

The property could also be in a parent (inheritance) class

waxen sandal
#

You gotta find the targetObject and then go through each layer to get your field

tidal pike
#

Does anyone know the class that shader graph uses for their right click add node thingy?

wraith crane
#

How can I get the SerializedProperty.NextVisible without modifying the actual property?

#

I want to get the next visible property as a return value, I don't want to modify this property

#

I should clone the property variable and use the clone instead of the real variable, but I don't know how to clone a SerializedProperty variable

(I've solved, I use FindProperty to clone the variable)

real ivy
#

So in my SO.someVariable, i can do <editor:PropertyField binding-path="someVariable"/>

But if it's contained in say, SO.someList[i].someVariable, how can i do the binding-path this way?

waxen sandal
#

I don't think you can

real ivy
#

😦

wraith crane
#

I can't get m_Script using .GetField("m_Script")...

As far as I know m_Script is a UnityEngine.Object variable, but I can't get the fieldInfo using GetField ()

waxen sandal
#

Isn't that only a serialized thing so unity can match it to the correct type

wraith crane
#

What do you mean? (I need the m_Script FieldInfo)

(I've found another solution, I don't need m_Script anymore)

real ivy
#

weaponVariance.Array.data[0] that's the serializedPath for list stuff

waxen sandal
#

Oh nice

real ivy
#

A .uss question..
I did <engine:Foldout text="Weapon Variance" class="heading" value="false">
But then all child of this thing gets the class heading effect. Checking the debugger of the child, it doesnt match any heading selector..

#

Style rules apply to the visual element and all of its descendants ok i guess that's how it works..

wraith crane
#

Can I get the editor instance from a serializedProperty? (The editor that is drawing the property)

onyx harness
#

No

wraith crane
#

Ok

#

I'll explain what I am trying to do

#

I have a class "MyClass" (that has some fields inside it) that is being drawn by a property drawer.

In the property drawer can I check if the value of some field of the class that contains the variable of type "MyClass" was changed?

#

I don't want to check if a field inside "MyClass" is changed. But a field inside the class that contains "MyClass" is changed

onyx harness
#

A sibling field of MyClass

#

You can't do that

#

PropertyDrawer is not fully aware of its siblings

wraith crane
#

Ok

#

And if I have a property attribute and from a property drawer I want to check if a value inside the same class (not a sibling) was changed what should I use? GUI.changed?

odd vessel
#

I'm creating a RenderTexture in code and attaching it to a camera.
I'm trying to execute this code in editor time (ExecuteInEditMode), but it seems to only work when using a RenderTexture that is an asset.
How do I get camera to render to a code-created render texture?

onyx harness
#

And if I have a property attribute and from a property drawer I want to check if a value inside the same class (not a sibling) was changed what should I use? GUI.changed?
@wraith crane Yep

#

You are the one drawing the GUI of the sub-fields, you are suppose to know who is changing already

wraith crane
#

Wait I am only drawing the attribute

#

I have a class:

{
     public int myVar;
     [MyAttribute]
     public int other;
} ```

I want to check from a property drawer of "MyAttribute" if any value ("myVar" in this case) is changed
#

I think I can't do that

onyx harness
#

You can't do that easily

wraith crane
#

Is there an hard way?

(Without drawing "manually" all the inspector in the attribute and check if a property change?)

tidal pike
#

Really dumb question, how do I open an editor window when I ‘open’ a scriptable object

onyx harness
#

Is there an hard way?

(Without drawing "manually" all the inspector in the attribute and check if a property change?)
@wraith crane Yes there is a hard way, as I stated, a PropertyDrawer (PD) is not "fully" aware of its siblings. But you can still know them and monitor their value

waxen sandal
#

Like double click? @tidal pike

#

There's an OnOpenAsset callback you can look into

tidal pike
#

I tried that, but i have a method and I would like to pass the ScriptableObject i clicked on to a method

#

and I cant pass this in a static function

wraith crane
#

My class that is in a random folder can't recognize classes that are in Editor folder...

How can make the classes inside Editor recognizable from outside? (I will use them only in editor, using #if UNITY_EDITOR)

weak spoke
#

do you use Assembly Definition files?

real ivy
#

https://forum.unity.com/threads/listview-binds-more-than-it-should.927744/#post-6068436

Anyone came across this problem with ListView?
Basically the bindItem callback is called multiple times when scrolling, on items thats already binded. Its like the bind is done without it clearing out the previous bind

devout iron
visual stag
devout iron
#

sozz

rancid cave
#

Anyone able to quickly point me in the right direction for editing the Animator editor interface?

#

End goal is being able to right click and duplicate layers in an animator

wraith crane
#

do you use Assembly Definition files?
@weak spoke nope

wraith crane
#

I am trying to make a property attribute that dynamically show/hides the variable in the inspector.

I have made a property attribute, the problem is that the OnGUI function in the property drawer is only called if the variable is public/serialize field.

How can I make my attribute work like SerializeField? (So if the variable is private, the drawer should be called)

waxen sandal
#

You need to a write an editor for a base class (preferably your own) then use that to check the attributes of the fields

#

Just a property drawer is not enough for that

wraith crane
#

Ok, I already have an editor that draws everything (UnityEngine.Object).. I'll make some tweaks to make it work, ty

onyx harness
#

I am trying to make a property attribute that dynamically show/hides the variable in the inspector.

I have made a property attribute, the problem is that the OnGUI function in the property drawer is only called if the variable is public/serialize field.

How can I make my attribute work like SerializeField? (So if the variable is private, the drawer should be called)
@wraith crane https://gist.github.com/Mikilo/8cb969a50a1eac87c9500d4f9f181324

#

Just a property drawer is not enough for that
@waxen sandal it is enough, but more complex to achieve

waxen sandal
#

That only works for serialized fields though

onyx harness
#

But showing/hiding fields are only for serialized fields, I don't understand your concern

wraith crane
#

You need to a write an editor for a base class (preferably your own) then use that to check the attributes of the fields
@waxen sandal well I can't use this method, because if I want to draw the field I need the SerializedProperty, if the property isn't public or [SerializeField] how can I get the SerializedProperty?

waxen sandal
#

You don't, you get the fieldinfo and figure out how to draw it yourself. Or serialize it

#

@onyx harness that's what he wants sooo

wraith crane
#

I have the field info, to figure out how to draw it what should I do? Put a lot of if(field is IDK) to check all the types?

(Can I serialize fields manually from my custom editor? How does SerializeField work?)

waxen sandal
#

Just check the type yeah

#

And you either need to add serialize field or make it public

#

But you can't edit it if you don't serialize

wraith crane
#

Ok

onyx harness
#

Ok
@wraith crane you can do anything you want manually

#

But the Serializer requires the fields to have their Type serializable, and either public or private with an attribute.

waxen sandal
#

Should do a write up about how editor scripting works

#

And how serialization works

#

And that you're not really interfacing directly with the instance of an object

severe python
#

Hey Mikilo, does NG Remote Scene work if you have no assets?

onyx harness
#

What kind of no assets?

#

If you dont possess the assets of the build, in your Unity Editor current project? @severe python

#

If so, yes it works.

mighty oasis
#

anyone know how to refresh a scriptableobject asset in the project folder? I've tried assetdatabase.import() and assetdatabase.refresh() and it doesn't work. the only way i could do it was to leave the folder and come back to it but i want it to refresh in code

wraith crane
#

How can I draw the array size of an array in the inspector? If I change the size, I want to also change the size of the actual array

waxen sandal
#

Use the default property drawer for the property

wraith crane
#

I am using a custom editor that draws every field (also the field inside the array), I can't draw the array "normally", I need to draw every field of the array manually

whole steppe
#

(Hoping this is the right channel)

So i'm looking to call functions on a specific script attached to a lot of the objects in my game using Timeline, i'm seeing that I would need a signal track and a signal receiver, the problem is the amount of objects that have this script, is there any way to just broadcast the signal gamewide without needing a receiver on each object?

keen pumice
#

@wraith crane you cannot change the size of an array. you need to create a new array of the size you want, and copy elements from the existing array into it. (or you could use a List<T> instead, which is dynamic in size)

waxen sandal
#

His question has nothing to do with how to change the size of an array

#

It has to do with how to replicate the default editor for arrays

keen pumice
#

How can I draw the array size of an array in the inspector? If I change the size, I want to also change the size of the actual array
@wraith crane

#

guess I misunderstood, oh well

whole steppe
#

@keen pumice i'll look into that, thanks

full vault
#

qq

#

how i can display List<GO>?

#
if (Script.Prefabs.Count>0)
            for (int i = 0; i < Script.Prefabs.Count; i++)
            {
                GUILayout.BeginHorizontal();
                Script.Prefabs[i] = (GameObject)EditorGUILayout.ObjectField($"Prefab {Script.Prefabs[i].name}", Script.Prefabs[i], typeof(GameObject), allowSceneObjects: false);
                if (GUILayout.Button("X")) Script.Prefabs.Remove(Script.Prefabs[i]);
                GUILayout.EndHorizontal();
            }
        if (GUILayout.Button("+")) Script.Prefabs.Add(new GameObject());
#

when i press create new create object on scene

#

i dont need to create it

#

i need to add value

#

@uneven jewel

waxen sandal
#

That's some random person

full vault
#

so

#

when i call new GO() it creates on scene

#

i dont need it

waxen sandal
#

It's a bit rude

#

I'm not even sure what you're asking

#

Do you want to add an empty element?

full vault
#

yes

waxen sandal
#

If so just pass null

full vault
#

no i cant

#
if (GUILayout.Button("+")) 
        {
            Script.Prefabs.Add((GameObject)null);
        } 
#
NullReferenceException: Object reference not set to an instance of an object
DungeonEditor.OnInspectorGUI () (at Assets/MapGeneration/Editor/DungeonEditor.cs:42)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <143cf05d15c44625b70169dc5194636e>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
#

oh shit

#

i forgot about smth

#

all work

#

ty

finite cliff
#

Hey so,

//select by search string (object name
script.targetString = EditorGUILayout.ObjectField("Target name", script.targetString, typeof(String), true) as String;

//select by transform (object
script.target = EditorGUILayout.ObjectField("Target", script.target , typeof(Transform), true) as Transform;

I'm trying to have both a transform field as well as a string field, transform field works fine but I can't seem to get the string to work

visual stag
finite cliff
#

text field worked, I didn't realize it was working because I was getting red squiggles all over as soon as i added it

#

works now**

quaint zephyr
#

This is probably an age old question. I have a class that is extension of MB class. And many of my component inherit from that custom class. In my custom class I have a couple properties that display on inspector. But because that class is sort of a base class, those properties get listed first. I want to write a [CustomEditor(typeof(CustomClass), true] script that will simply place those base properties at the bottom of all other properties defined in the componetn classes. What's the quickest and cleanest way of doing this?

waxen sandal
#

I usually just make some helper functions that draw all things with a few exceptions

#

And then draw those exceptions later

quaint zephyr
#

can I get a sneak peak?

waxen sandal
#

I can give you some pointers but I can't share my code

quaint zephyr
#

Just like generic/sample code. A quickie.

waxen sandal
#

Uhh, no.

quaint zephyr
#

Oh yay! I accidentally stumbled on it. I installed NaughtyAttributes and but a BoxGroup around them, and now they appear at the bottom of the inherited scripts! I feel like I hit the lottery on this one haha

#

😆

austere sun
#

I'm trying to write a property drawer to rename backing fields to a useful name<foo>k__Backing Field -> Foo, but this broke array drawing

using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEngine;

[CustomPropertyDrawer(typeof(bool), true)]
[CustomPropertyDrawer(typeof(char), true)]
[CustomPropertyDrawer(typeof(double), true)]
[CustomPropertyDrawer(typeof(float), true)]
[CustomPropertyDrawer(typeof(int), true)]
[CustomPropertyDrawer(typeof(object), true)]
[CustomPropertyDrawer(typeof(short), true)]
[CustomPropertyDrawer(typeof(string), true)]
public class BackingFieldEnhancedPropertyDrawer : PropertyDrawer {
    private static MethodInfo defaultDraw = typeof(EditorGUI).GetMethod("DefaultPropertyField", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
    private static Regex pattern = new Regex("<(.+)>k__Backing Field", RegexOptions.None);

    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
        var match = BackingFieldEnhancedPropertyDrawer.pattern.Match(label.text);
        if (match.Success) {
            StringBuilder sb = new StringBuilder(match.Groups[1].Captures[0].Value);
            sb[0] = char.ToUpper(sb[0]);
            label.text = sb.ToString();
        }

        BackingFieldEnhancedPropertyDrawer.defaultDraw.Invoke(null, new object[3] { position, property, label });
    }
}```

```cs
using UnityEngine;

[CreateAssetMenu(fileName = "New Test", menuName = "Gameplay/Test")]
public class TestObject : ScriptableObject {
    public Foo[] foos;

    [System.Serializable]
    public class Foo {
        public string bar = "hi";
    }
}```
stone summit
#

Library\PackageCache\com.unity.inputsystem@1.0.0\InputSystem\Plugins\HID\HID.cs(14,10): warning CS1030: #warning: 'The 32-bit Windows player is not currently supported by the Input System. HID input will not work in the player. Please use x86_64, if possible.'

#

why is this an issue?

#

new project, with new input system

#

??????

barren moat
#

@stone summit looks pretty self-explanatory to me. You need to change your build target to 64-bit.

#

According to that message anyway.

full vault
#

Qq all

#

How i can interact with gizmos?

waxen sandal
#

You don't

#

Use Handles

full vault
#

@waxen sandal how i can shift field?

#

Too much free space

steady crest
#

@full vault custom editor with LabelWidth on the property

full vault
#

and one more question

#

how i can get asset path

#

like C:/...

#

maybe this Application.dataPath?

full vault
#

awsome @steady crest

#

ty

waxen sandal
#

EditorGUILayout.PropertyField should support multi object editing right?

#

hasMultipleDifferentValues is false for some reason 🤔

#

Bleh, apparently we're making a new SO for each instance so it doesn't think they're the same

lean vault
#

k ummm i hit the wrong button in pro builder and this popped up but when i try to delete the script i get 168 errors