#↕️┃editor-extensions
1 messages · Page 71 of 1
OH F me!
Your 100% right and I am just stupid. I had it in my head that CanEditMultipleObjects was for components (I was thinking of CanHaveMultiple). I am real sorry, and thank you.
I'm modifying Texture2Ds data via an AssetPostprocessor. These Texture2Ds are all stored within a SpriteAtlas. How can I ensure the SpriteAtlas is updated and repacked after I modify the data?
You use your eyes
@onyx harness No, seriously. I want this to be automatic.
I would say look for the code executed when you press the update button
hello. ive been having some trouble with visual studio code, the intellisense doesnt show up. i have the c# extension in VSC, and VSC is set as my external script editor. any idea what i can do?
also, im not sure if this is the right place to ask, so i apologise if ive made a mistake
Did you follow the guide pinned in #💻┃code-beginner ?
yes
No clue then
Hey, is there a way to add a button to all inspector windows? For example, right next to "Add Component" button?
@chilly stone I would say the first step is finding where Unity is drawing that Add Component button
Looks like it's being drawn with UI Elements in the latest Unity versions
Hmm is it? In 2020.1.4f1 it's inside IMGUI container
It's really hard to find any info on such narrow topic. I guess I'll look into source code of some packages that modify an inspector...
You just get the root element
Then find hte IMGUI container it's drawing in
And add an element next to it
@waxen sandal how would I get that root element, from what kind of script?
Find the editor window with Resources.FindObjectsOfTypeAll
Oh it works that way
So do I just do that in a class that doesn't extend anything similar to EditorWindow?
Depends
You might have to do it in some event since it might recreate that button every time your selection changes
Yeah that's what I'm trying to fugure out
Override Editor for GameObject, draw a button at the top of the Inspector
@onyx harness yeah that works too, but can I modify or remove certain elements in inspector?
Define elements
Buttons, checkboxes, text fields
If elements are drawn using IMGUI, you are doomed
If it is using UI Toolkit, then you can manually scan and remove them.
This path is much more likely to raise issues
I mean, Unity doesn't use UI Elements for default inspectors yet, so no
Inspector stuff is inside IMGUI containers. Let's say, I want to modify how inspector header looks, how do I access it?
Oh so I cant actually remove it from hierarchy and have to draw over it?
Interesting
Oh you can remove it
Revisiting the Inspector (Poke me to join the future open beta of NG Flow Inspector)
#madewithunity #indiedev @AssetStore #unity3d #gamedev #ngtools https://t.co/gB74rQwqqE
I tend to keep them, in case they are "needed"
Oh neat stuff
A little intimidating compared to simple inspectors I'm making :)
Are you using purely IMGUI?
A mix
Oh, I would also like to ask is it sane to make property drawers using UI Elements?
I never used them this way, but it is the future of it
Yeah, I hate to extend UnityEditor.Editor for each inspector that has UIE drawers in order for them to be visible...
When will they make inspecotrs to use UIE by default...
It's always on their roadmap but never gets finished
hey all I'm using UI Elements and trying to get a value from a Toggle. I've noticed there's no "onChange" event so what's the proper way to do this?
most of the UI Toolkit elements have RegisterValueChangedCallback e.g. Foldout does - I assume Toggle has one too @leaden lodge
@chilly stone Oh I was just messing with the inspector stuff most of this weekend. If you got any questions you can feel free to @ me. Opening the UIElements Debugger for the inspector will show you what you have to work with. It is actually quite a bit.
Sure, for now I have no questions :)
How do I set up C++ in Microsoft Visual studio
Not the right channel but @whole steppe
https://www.youtube.com/watch?v=F3ntGDm6hOs&list=PLEMXAbCVnmY6RverunClc_DMLNDd3ASRp&index=2&t=0s
Day 1 of the introduction to C programming on Windows series from Handmade Hero. See http://handmadehero.org for details.
- Getting up to speed with C programming on Windows
- Getting a C compiler via Microsoft Visual Studio Express:
2.1. Caveat: In the next video, we sug...
@gloomy chasm hey, so how can I get a whole hierarchy of inspector window?
This is how I'm getting an actual window:
var inspector = Resources.FindObjectsOfTypeAll<EditorWindow>().FirstOrDefault(w => w.GetType().Name == "InspectorWindow");
But inspector.rootVisualElement doesn't conatin any children or parents. Can I somehow load them in or am I doing it wrong?
@chilly stone When are you getting the inspector window? It may not be loaded yet. I had to put the call inside of a method called from EditorApplication.delayCall
Also if you're trying to find UI Toolkit elements in Unity editor windows, a lot of them don't have any as they're still mostly imgui
That is true for most, but the Inspector actually ahs quite a few. Each component header, body, and footer is it's own element.
Anyone know of extensions that allow me to change my formatting?
I want this
Function() {
if () {
}
}
Instead of this
Function()
{
if ()
{
}
}
Hiho! I made a simple Editor Script that resets object position, but now I want to add an Undo step to it.
I've tried this:
go.transform.position = Vector3.zero;```
but it doesnt seem to work. What am I doing wrong?
I think you need to use Undo.RegisterCompleObjectUndo instead.
I have never actually used RecordObject my self or seen it used while looking the Unity's source on Github.
Idk what it does tbh 😛
Have you tried Undo.RecordObject(go.transform, ... instead?
going to try both right now 😮
well, @uneven arrow said what i already have, and @gloomy chasm doesn't seem to work either.
There are some steps we are probably missing
Idk why, but I have this working w/o problems. It's in Editor script though, executed from OnInspectorGUI — in case it's any relevant
Yeah, @glacial onyx where is his being run from?
It runs while using the unity editor. No playmode or anything
sec, ill share the code
its just a command, doesn't say anything about OnInspectorGUI
file is in Editor folder
Have you tried recording the transform instead of the whole GameObject?
Also, unrelated to your problem, but I would recommend using undo groups
Just tested a MenuItem command — doesn't work either.
So I'm guessing it only works within one of the Editor callbacks
@gloomy chasm that worked! Crazy simple solution >.< gosh, i'm so dumb.
It works now, thank you! 🙏
go.transform.localPosition = Vector3.zero;```
Have you tried
Undo.RecordObject(go.transform, ...instead?
@uneven arrow Lol
Now I have to figure why my stuff doesn't work 😬
ah, i didn't read it through, im sorry @uneven arrow >.<
i read it, but i didnt SEE it, you know
Be careful please when people send help, sometime we crush our brain to understand while we obviously already gave the solution.
It's a non-sense
Indeed. Imma read and compare more thoroughly
I've been struggling with this too. The way I understood it was: RecordObject only understands direct modifications of object's properties, not its subtree. Also, the object has to be serializable (and probably a subclass of Component too)
It's because Object are treated differently.
As reference, not plain object
This subtlety makes the whole thing
Still depends on how they actually implemented the RecordObject, but yeah 👍
Not even.
It is how the whole serializer works.
Otherwise, if you record a GameObject, that obviously has a Transform, which also links to its GameObject.
Infinite loop.
@glacial onyx btw, here is a short thread about groups that even show exactly how to use them https://forum.unity.com/threads/undo-create-group.309218/
So best way is to record a GameObjects properties, whatever they may be, yes?
@gloomy chasm pretty interesting. Imma be sure to use much more of these for sure. This is incredibly useful
if you record the GameObject, it is because you plan on modifiying one of its direct properties.
Name, flag, static, layout, etc.
Otherwise, if you record a GameObject, that obviously has a Transform, which also links to its GameObject.
Infinite loop.
@onyx harness Don't want to make an offtopic out of it, but it's definitely possible to finitely traverse the graphs with loops simply by remembering which nodes you've already traversed 😉
I know I know it's possible, but it doesn't work like that in Unity
They recently implemented new attributes like [SerializeReference] to implement this behaviour.
But this is very recent.
(And it is amazing)
And we've been fighting hard to have it.
Not me directly, but I had a discussion with Superpig on Slack (The main dev of the Unity serializer)
He said "performance reason"
Look at it now, they implemented it
Well, just ran into an issue with this. How about resetting an Active Element. I deactivate it, but cant undo to reactivate ^^'
Strange, should work.
Sec, Imma think a bit more about this
Well, ignore what I said, it works. I was making unnecessary comparisons
trying to use GUILayout in PropertyDrawer but it gives me group id 1 error
First rule of PD, don't use GUILayout
is the 2nd rule have something to do about the 1st rule ?
swapped to using rect's but not all the elements are appearing behind the normal UI lol
Rect buttonRect = new Rect(
position.x,
position.y + ((1 + buttonHeight) * (( i + 1 ) - 1)),
position.width,
buttonHeight - 1 );
oh nvm had a wrong return value in GetPropertyHeight
Custom Inspector. I typically used EditorGUILayout no issues. But in this particular situation, I have a Horizontal Group where I used EditorGUILayout.ObjectField, but I want to follow up with a couple GUI.Buttons. The buttons were a sinch to make because of EditorGUILayout.GetControlRect().
However, the problem now is how do I get EditorGUILayout's control rect "back on track" now that GUI class drew over it? Is there a way to "set" the ControlRect in the EditorGUILayout?
Has anyone worked with EditorUtility.DispalyProgressBar and EditorApplication.update before?
I'm currently having an issue where I've subscribed to the EditorApplication.update event, and I'm calling EditorUtility.DisplayProgressBar inside the function, but it's not displaying
@quaint zephyr GUILayout.Space
Hello. How can i cast this so it works? thank you i have never had experience with custom editors before.
How do i solve
ive tried numerious combinations, but obviously i dont understand what im doing
Anyone?
if you want to display an array you should probably use PropertyField (SerializedObject, SerializedProperty, etc)
have anyone seen this before ?
void OnSceneGUI()
{
using( new GUILayout.VerticalScope( GUI.skin.window ) )
{
using( new GUILayout.HorizontalScope() )
{
GUILayout.Label("Hi");
}
}
}
i want to create something like this , i know its possible i have done it in the past
ok found it
it needs to be wrapped in Handles GUI
Handles.BeginGUI(); :: Handles.EndGUI();
:3
Is there a way to add custom menu items to the existing Animator context menu(s)?
@tulip plank [MenuItem ("CONTEXT/Animator/Your function")]
example of adding a function to the Transform context menu to randomly rotate it
[MenuItem ("CONTEXT/Transform/Randomize Yaw")]
private static void RandomYaw (MenuCommand command)
{
if (command.context is Transform transform)
{
Vector3 v = transform.localEulerAngles;
v.y = (v.y + Random.value * 360f) % 360f;
Undo.RecordObject(transform, "Randomize Yaw");
transform.localEulerAngles = v;
}
}
Innnteresting, I will check this out, thank you very much!
this is super nitpicky but...
I'm working on a foldout scope so i can define a scope and any gui within it will only be drawn if the foldout is expanded
usage looks like this
using (var foldout = new FoldoutHeaderScope(resolutionPerMeter, "Texture Settings"))
{
if (foldout.expanded)
{
// Draw properties here
EditorGUILayout.PropertyField(resolutionPerMeter);
EditorGUILayout.IntPopup(maxResolution, MaxSizeContents, MaxSizeValues);
EditorGUILayout.PropertyField(compress);
EditorGUILayout.PropertyField(storeExtraInfo);
EditorGUILayout.PropertyField(padding);
}
}
checking if (foldout.expanded) is a lil redundant since it's implied that the gui within the scope shouldn't draw if the foldout isn't expanded. not really a big deal, but is it possible to disable gui drawing until the scope is disposed automatically if the foldout isn't expanded? would be cool to just plop gui code within the scope and not have it draw/not drawn automagically based on the state of the foldout
fuck wrong gif
there we go
I would say yes, I think it is doable, but the trick is tricky
@wispy delta use clip
goootcha. i haven't used clipping before so correct me if i'm wrong, but would the idea be to BeginClip with a rect flush to the bottom of the foldout header with a height of 0 if the foldout is not expanded?
making a clip scope correctly hides the gui, but the layout is still affected @onyx harness
do you know if there's a way to avoid that? also if you think this is a dumb thing to do lemme know haha, it's not a big deal if i have to do a single bool check lol
Maybe use Area
@wispy delta
Or the other trick would be to use GUILayout.Space with a negative value, to negate the height used by your drawings
oh damn that's genius haha
looks like Area works tho! thanks 💙
@onyx harness Thanks
So I have done quite some coding on editor extensions, particularly, when editor loads it downloads data I have online for debugging feedback files that are submitted by users from their apps. It's all working fine. But now the issue is when it came time to build, I am getting a bunch of errors because quite a few of my scripts are UnityEditor based and use attributes and EditorApplication events and such like.
Some of these scripts I don't even need in production, but I do use in development
How can I EXCLUDE these scripts from build?
I know how to exclude parts of scripts using #if UNITY_EDITOR directives.
But would I just slap #if UNITY_EDITOR around the entire class? Or is there a more simpler/cleaner/conventional approach to this?
@onyx harness Thanks
@quaint zephyr Huh? What have I done?
Editor scripts are not embedded in the build.
Even better, anything inside folders Editor are not embedded
@onyx harness it was for my last question yesterday.
Yeah that's what I thought too, but turns out I had asmdef for that group of scripts and in there it had iOS ticked instead of just Editor by itself. 🙂
Does anyone know how to create one of the new "Busy" progress bars in 2020.1? I need to run a blocking operation on my scene to process a bunch of data but at the moment all I can manage to do is a background task
I know the old way of doing it is just https://docs.unity3d.com/ScriptReference/EditorUtility.DisplayProgressBar.html
and then in the try's finally do a https://docs.unity3d.com/ScriptReference/EditorUtility.ClearProgressBar.html
There's also a cancellable version. You just call the Display repeatedly with a new progress value.
hms, is there a way to detect when a prefab has been edited, from the perspective of the instances?
I currently have an issue where I want all my instances to update cached non-serialized stuff when you edit their corresponding prefab
there is a callback in prefab stage when you leave edit mode there, so I could scan the scene for instances of the edited prefab and update them, but, this feels like it might be really costly and wasteful, and it also doesn't cover the case where you edit the prefabs through the inspector
Hello anyone here can help me ?
i got following problem:
This Github Script is an Editor Extension:
https://gist.github.com/NeatWolf/a59e6ef40ee613755457925c465b24b4#file-replacematerials-cs
but does not work.
Error i get:
FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
ReplaceMaterials.ReplaceSelected (UnityEngine.Material material, UnityEngine.Material replaceMaterial, System.Boolean recursive) (at Assets/Editor/ReplaceMaterials.cs:54)
ReplaceMaterials.OnGUI () (at Assets/Editor/ReplaceMaterials.cs:23)
Any ideas ? Please if anyone understand this - it s a big help, i have 0 Plan here.
You have null mesh renderers
so Script need to have a Mesh Renderer ?
Oh sorry, your exception is not even NullException
The stack trace does not even follow the script lines
i am Sorry, but: i happy if you can help. Because: i do nothing understand from this script.
== 0.
if (brainhavefailed== True)
{
thePersonAsksistostupidforthis = true;
}
You can give it a try to NG Asset Finder Free on the Asset Store
so i never write Editorscripts or somethign big.
i do not understand the codeLines he use.
but a Script like this, will be a so much big help in my project ...
NG Asset Finder ?
oh boy :(
Thank you for the Asset, but this makes a Script of ~ 100 Lines
to a Handbook of 49 pagves, eaven to understand what this assetfinder do.
not so really useful, because: Nobody knows if he find anything at the end
hm, no i am sorry, will not help, because: does work with gameobjects if i umderstand right ?
You did not read well then
yeah, i understand what it does, but not how it can help me.
if i have a Reference in Scene hmmm. Moment, Did it work with materials to or only gameobjects ?
It works with any Object against any Object
no i am sorry, this is not useful.
1 GameObject have 4 - 6 Materials
1 prefab, having 700 GameObjects using this 6 Materials.
so i need to replace the Materials, not the Gameobjects.
( i hope you understand what my problem is )
And it looks through the Project, or the entire scene
yeah i see 🙂 it s not that bad, but not useful in my situation
but, hm, maybe ... one moment
This picture alone does what you said
But you preferred to read fast and skip 90% of the information
one moment.
yes, because you have a Documentation, for all aassets, i just look for the "Finder"
yeah, give me a second, i want to try something.
If you feel it is too big, I can't do much for you unfortunately
It worked for you?
worked a little other than expetet, but it works this way 🙂
This tool allows you to replace or find any Object. You provide one, I do the search.
the First ( i have not done until this moment ) is to replace all Materials i have . because my Blender model have different names here or there
But this i need to do 1st Time > after this it should work in minutes not in horus i need today
Replacement is pretty quick
You see, no stress here, stay relax and calmly read the advices/tips you are given in this channel, we are here to help
hm not that bad idea: i think i put this in my favorites, not this month ( out of money for this month ) but ... 😄
can be a nice idea
Try NG Tools Free
It gives you a taste of the power under
And there is several free tools in there
i got Assetfinder this time, i do have a look in the other next time 🙂
i see, you have a lot online there
oh , moment i write you private
Just to cover all the tools, taken one by one, it is not that big
weird question, is it possible to change the setting for which input system the current project is using from script? I'd like to make the current project use the new Unity input system in an editor script
Is there a way to make custom project templates for the Unity Hub?
before I continue down this rabbit hole of reflecting into internal functions is there some official Unity-supported way of changing the new input system settings in editor script?
I found two settings inside of ProjectSettings called enableNativePlatformBackendsForNewInputSystem and disableOldInputManagerSupport and I am currently looking at reflecting into internal functions to change them
this is strictly an editor script so it's not happening at runtime
Tbh, I'd just look at the settings window
oh I am looking at the source for the window
it's changing a serialized field which uh
doesn't exist
this.m_EnableInputSystem = this.FindPropertyAssert("enableNativePlatformBackendsForNewInputSystem");
Fonts have a bunch of those things as well
yeah that's what I suspect too
and that's the current route I'm going down, just trying to access their internal functions to modify this
I just didn't want to continue down this path if there was some easier way to do it
I don't remember the exact way to get the ProjectSettings SerializedObject
But once you get that it should be easy
@onyx harness probably remembers
typeof(PlayerSettings).GetField("_serializedObject", BindingFlags.Static | BindingFlags.NonPublic);?
seems to work
oh hm it's null when I try to get a value
ok I found the GetSerializedObject method and it grabbed something let's see how it goes
Is there a way to know if an Editor is expanded? I'm embedding some component editors within another component's editor instead of having them drawn in the inspector and need to create foldouts. SerializedProperty.isExpanded is handy for storing (and remembering) if a property is expanded or not, but I can't find an equivalent for an Editor
hi want to ask
how to get sprite can search through editor?
want to create something similar like this
but in UnityEditor + has a preview of the image
@onyx harness probably remembers
@waxen sandal you just need to load the settings directly from ProjectSettings/ with AssetDatabase
Is there a way to know if an Editor is expanded? I'm embedding some component editors within another component's editor instead of having them drawn in the inspector and need to create foldouts. SerializedProperty.isExpanded is handy for storing (and remembering) if a property is expanded or not, but I can't find an equivalent for an Editor
@wispy delta it exists, but it's quite stuck into Inspector code
I figured. I was spelunking around the decompiled editor code but couldn't find it anywhere!
but in UnityEditor + has a preview of the image
@strong phoenix your gif is already in Unity Editor and it shows a thumbnail of every sprites. I don't get it
I figured. I was spelunking around the decompiled editor code but couldn't find it anywhere!
@wispy delta I'm not home, can't look, but I'll give a glance tomorrow
Would be so rad if unity let you store your own custom serialized data on a serialized object for stuff like this
so.AddProperty("expanded", false)
Would be so helpful
@strong phoenix your gif is already in Unity Editor and it shows a thumbnail of every sprites. I don't get it
@onyx harness oh sorry, iin EditorWindow
not in inspector
and i want have a preview image of it, how do i do that(?)
if i can say, want hav sumthin like this in my EditorWindow
Would be so rad if unity let you store your own custom serialized data on a serialized object for stuff like this
so.AddProperty("expanded", false)
Would be so helpful
@wispy delta well it already exists, just need to find it
Oh neat! Good to know
if i can say, want hav sumthin like this in my EditorWindow
@strong phoenix your Object field? Set a big height. I don't remember the minimum.
But the preview automatically shows up if the height is enough.
Perhaps 140F.
Or more like 100 maybe
Just give it a try
So I'm trying to make a scene profile editor. Basically, it's an editor for scriptable object that contains a list of scenes which you can load for quick testing. I implemented a reorderable list using UI Elements. Each element in a list has PropertyField that holds an individual SceneReference, which is drawn by IMGUI drawer. It looks like this:
And it works 100%, scenes get added and removed, but I get those errors every time I remove an entry from a list (by pressing minus button)
I tried changing serialization, drawer, but I have no idea what could cause these errors.
They seem to disappear when I don't use IMGUI drawer for each element. Maybe ListView doesn't like that I use drawers inside it... idk
https://github.com/Krendeled/Untitled-Ball-Game/blob/master/Assets/_Project/Scripts/SceneManagement/SceneReference.cs
https://github.com/Krendeled/Untitled-Ball-Game/blob/master/Assets/_Project/Scripts/Editor/Drawers/IMGUI/SceneReferenceDrawer.cs
https://github.com/Krendeled/Untitled-Ball-Game/blob/master/Assets/_Project/Scripts/SceneManagement/SceneProfile.cs
https://github.com/Krendeled/Untitled-Ball-Game/blob/master/Assets/_Project/Scripts/Editor/Editors/SceneProfileEditor.cs
Here are relevant files if anyone is willing to look into this
what's the name of the node graph api ?
Hey,So for some reason when I was invited to a team,I can't see it in unity hub,and I can see another team. I tried logging in again,but I still can't see it
I am not sure where to put this
Yeah, #↕️┃editor-extensions is definitely 100% the right place to ask, good job 👏 👏
anyone knows how to get access to the lock function in code ?
i need to make a shortcut for this sucker
@tough cairn UnityEditor.InspectorWindow.isLocked
im guessing its for the current focus one ?
Yes
ty ty
This is not static
yea im looking at it rn
https://github.com/Unity-Technologies/UnityCsReference/blob/61f92bd79ae862c4465d35270f9d1d57befd1761/Editor/Mono/Inspector/InspectorWindow.cs#L29
Just use m_AllInspectors and the job is done
Basically the same
true true
Or you can directly use ActiveEditorTracker.sharedTracker.isLocked
This one is for the current one
isn't not internal ?
This one is public
Inspector uses this one.
Lock is specifically Inspector
the hamburger menu is urs ?
neat
ShowButton works like OnGUI with a Rect
for any Window class ?
Any, just respect the definition
Like Update, OnGUI, Awake, etc.
ShowButton works the same
i see
handy
🤔 i need a cheat sheet of those lil things no one actually speaks about
I will do one "soon"
I will do much more
What you see, is Unity Editor in HTML 🙂
I am willing to make an interactive tutorial on a website
i do enjoy using immediate mode UI - its relatively clean and quick for simple tasks
Where you just need to hover an area to receive an explanation
There is a shitton of hidden spot/gem, editor people don't even imagine
how would i display a field like this in a custom EditorWindow?
@onyx harness i made one -> https://github.com/nukadelic/UnityEditorIcons
its a single file xD
Looks nice
i have many scripts already to display icons
but can you export them to a file?
i think i had something like that added there
how would i display a field like this in a custom EditorWindow?
@vapid scarab I guess it is an ObjectField?
Because Unity textures are read-only
hmm, maybe my usage was wrong, i tried that, didnt display. ill try again
the scans don't include all the icons
i found a list of extra icons that are missing and added them manually
somebody decompiled the dll and posted a list on unityList.com*
ah ok :: Resources.FindObjectsOfTypeAll<Texture2D>()
@onyx harness any way to draw on top of the inspector ?
yea lol - that's too OP
Thanks
So.. i recently downloaded the headless builder, its editor extensions were part of the editor.. Then some else crashed Unity and its mention isn't there anymore
can't figure out how to gets its menu back..
i try to reimport the packae and it won't let me select the areas where the scripts, fonts, and so on are
deleted it completely and re-added it... it must of made changes that weren't saved before my unity editor crashed
i am calling GUILayout.Window in top of every element still its showing under them how can i fix it
What is GUILayout.Window?
It's order dependant
If you want to draw it on top it need to be the last one you draw iirc
how to stretch graph view to parent size ?
is there a way to create UIElements without xml and uss ?
ah nvm i see there is a IMGUISupport
Hiho!
How do I detect if mouse is inside the game window tab in an editor script?
EditorWindow.mouseOverWindow https://docs.unity3d.com/ScriptReference/EditorWindow-mouseOverWindow.html
That should do @glacial onyx
@gloomy chasm imma check it out, thank you again! 🙏
@gloomy chasm doesn't exactly tells me if im in game window, but i manage to get its reference with 'getInstanceID()' which is pretty nice. Thank you!
@glacial onyx Haha, well I mean I think they only way to get more direct was if there was something called like IsMouseInGameWindow but that would be honestly pretty useless most of the time. You can do a check if the window is the game window and you will have what you are looking for 🙂
Hello friends,
is it possible to change the font size in the tabs ?
i mean the tab title "Main" "Interactable" etc.
let me see.
how to flex items on the vertical axis ?
my toolbar is appearing under the body element
am i doing something wrong ?
ok nvm i figured it out -> removed Body.StretchToParentSize();
Hello peoples, I'm wondering if this is a bug or I'm not understand something about UI elements. I have two elements that both have a links field.
[SerializeField]
public List<NodeLink> links = new List<NodeLink>();
The UI elements debugger clearly shows them as different elements, but when I expand or contract the list for one element in does so for ALL elements with the links field.
Sounds like a binding problem
can something like this be done : cs var vsa = new VisualTreeAsset { text = "<UXML ... " };
@tough cairn why are you looking for ways to couple everything together? That defeats the purpose
UI Elements was designed in a way to separate concerns and make your tool development easier. Don't make it hard for yourself, it takes couple of hours to learn uxml and uss syntax 
Don't like it? Use IMGUI
We're kinda forced to use IMGUI for property drawers currently
i think immediate mode is superior, change my mind
Editors can be fully implemented with UI Elements, you can check out Unity examples https://github.com/Unity-Technologies/UIElementsExamples
( not IMGUI vs UIElements )
What makes immediate mode superior to UIE?
immediate mode as in a design paradigm , i come from sass less html angular vue ect ... learning imgui just makes so much sense
speed
UIE is event-driven, IMGUI is update-driven, but one makes more sense and afaik is performant (UIE)
what u see is what u get
sure , we are talking about specific api's , im talking about a design paradigm , imgui could be optimized but unlikely will , i understand that
If you're used to IMGUI and don't want to learn new paradigm (although I wouldn't call using events and queries a paradigm) - completely understandable, by all means use it, untill it's deprecated.
ehmmm
read above
immediate mode as in a design paradigm , i come from sass less html angular vue ect ... learning imgui just makes so much sense
So? What's forcing you to switch to UIE then?
playing around with graphView
Ah that
nothing is forcing me 🙂
I'm just saying, if you're switching to a new stuff, do it the way it's designed. It's the same as trying to go agains a component system in unity (not talking about ECS)
i didn't go too deep into UIE but i already see some pitfalls were imgui would suit me better
in terms of convenience and speed
You mean speed of development?
ye
do u always load stuff in UIE in absolute paths ?
like AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/U...
I used to do this, recently I solved it by making DefaultEditor class: https://github.com/Krendeled/Untitled-Ball-Game/blob/master/Assets/_Project/Scripts/Editor/Editors/DefaultEditor.cs
As I always call my uxml and uss by the name of editor class, it works
You're welcome :p
👍
Did you ping me?
What's going on?
👋 hi hi
was looking for this : UXML could be easily replaced with C#
( link above )
that's what i was thinking as well
In a plugin (as DLL) point of view, it makes sense
Do you imply that more files = bad?
Nope, just as a publisher
I can't see a point of being afraid to make 2 more files per editor, doesn't seem like an issue 🤷♂️
time
Compile-time?
I dont like to bloat the folders of my users.
human valuable seconds lol
There's an option to create them at the same time, if you're concerned about that. They even get filled in properly
Could you elaborate, what same time?
I mean when you want to create an editor, there's Create->UI Toolkit->Editor Window
It creates all 3 files filled in with basic code
That was response to Wad1m complaining about how long it takes to setup UIE editor :p
wdym?
oh its a template generator
that wasn't the point lol
miliko wanted to reduce the file count
hence the in line uxml & uss
Not giving access to direct source prevents the users from altering them easily.
also its better to avoid assets clutter - like when u have bunch of small textures for an editor - it will appear in ur project as well
But for my development, yes I would gladly use 3 files. And then convert them to C# at the very end.
I agree, but saying in general that when you have a lot of files - your code is imperformant or bad - is a stupid statement 🤷♂️
I never said that and never will
Compilation speaking, thousands of files do impact
Thx to AsmDef, the problem is reduced
You said "it's better"
quicker 🙂
yo check it out
pure IMGUI 😛
That's not surprising, of course you can do anything as complex in IMGUI
¯_(ツ)_/¯
IMGUI is cool for quick development
But for complex stuff, you need a good understanding of it to go deeper
yea the deeper u go the more hax there will be
Or you might lose on the performance side.
At the moment the user feels it, you lose
Is there a way to have custom themes on the editor?
Thanks :)
EditorStyles is build in
I'll check it out
But Unity Editor has few sets of styles that you can modify
Ah ok
To come back to IMGUI, the memory may also be a concern, it can generate a lot of garbage
But since we are on a standalone Windows or Mac, 99% of publishers or coders wont bother themself
I'll give it credits, speed dev, IMGUI is very good
@tough cairn if your point was what you showed is not possible in UIE - look into some of these examples https://github.com/Unity-Technologies/UIElementsExamples/tree/master/Assets/Examples/Editor there's side by side comparison between IMGUI and UIE, and most of the stuff that's done in one, can be done in the other. But IMGUI is indeed quicker if you worked with it for a long time.
ye ik
But feature like Z-index or culling, this is shit
i just hide all and replace when needed
bye
@onyx harness you need to start a youtube channel if you don't have one 
There's not enough stuff on the net about editor tooling in-depth
I'm preparing an interactive tutorial about Unity Editor scripting 🙂
Looks like this for the moment
It's pure HTML
That's great, hit me up when it's available
and of course, still a prototype
@onyx harness Are you recreating Unity's UI in HTML?
immediate mode is a bad paradigm, change my mind (don't bother)
@short tiger Yep
This is purely for visual, so I can integrate tutorials in any spot
Wouldn't it be possible to draw tutorials on-top of Unity's actual UI?
Presumably, someone who is interested in learning about Unity editor scripting already has Unity
There are pros and cons to do tutorials on Unity or on a website
Unity:
- You need to install and run Unity.
- You need to install the tutorial (From asset store, or Package Manager, or git, whatever).
- Harder to maintain. (Unity releases a version every week...)
- Harder to write the integrated tutorial.
- Feeling is better, since you execute directly in Unity.
Website:
- No install at all.
- Might be difficult to maintain.
- Tutorial can be added very easily.
- Developing the whole Unity Editor in HTML can take quite some time. (But I already achieved the fundamental)
@short tiger
So this tutorial is aimed at absolute beginners?
You will need C#
Or would it be more open source so anyone can contribute to make tutorials.
But I will try to explain the very basics, and it will go deeper for those advanced
Ah I see.
The system I am writing not suppose to be open source.
Cause it takes time to make a system with people, users, rights, etc.
Ok
But wouldn't it make more sense to only have beginner tutorials on the website UI?
How would you define beginner level?
I am planning to make it visually understandable ! 😄
Hmmm. A simple platformer like the one in Brackeys How to make a Video Game in Unity Series.
You will see the Unity Editor, and I will spot Question Marks at some place, and by hovering these spots, I will display explanation of how to access this spot by code.
Then if you click on it, I will detail the integration
Oh sorry, it does not plan to teach gameplay
It's purely for Editor stuff
Yes.
Editor, PropertyDrawer, EditorWindow.
All the interesting API, hidden API.
Internal stuff.
Serialization.
Because too much people in here come and ask "hey how do you add a menu item here?", "How to do like the lock button in the Inspector?"
With my tutorial, I'll put them before your eyes
Haha idk what half of that stuff means but nice
You're a good target then 🙂
Hehe I'll definitely check it out once it's done
How can I execute a code after Unity extensions get initialized?
AfterSceneLoad After Scene is loaded.
BeforeSceneLoad Before Scene is loaded.
AfterAssembliesLoaded Callback when all assemblies are loaded and preloaded assets are initialized.
BeforeSplashScreen Immediately before the splash screen is shown.
SubsystemRegistration Callback used for registration of subsystems
not sure if that's what u mean by extension init
there is also [InitializeOnLoad]
I'm using DidReloadScripts to execute some stuff which uses reflection every time the user recompile or load its scripts. The problem is that when you launch Unity editor this method is called before unity extensions get initialized
And so I get Unity extensions are not yet initialized, so we cannot say if the 'C:/Program Files/Unity/Hub/Editor/2019.2.17f1/Editor/Data/UnityExtensions/Unity/UnityVR/Editor/UnityEditor.VR.dll' is compatible with platform Win64
So, I would like to wait until Unity extensions are initialized before execute my code
maybe try AfterAssembliesLoaded
Ok
have u seen this one : https://forum.unity.com/threads/how-can-i-callback-after-the-scripts-compilation.819492/ ?
I'll check that, thanks
@onyx harness have you by any chance worked with SerializeReference attribute?
@chilly stone Not yet no, unfortunately
I only start using new features, when I drop the support of the last version of Unity not supporting it.
Since I support 2018 LTS, it doesnt have it I think
quick question : anyone knows how to open file like form console ? ( hyperlink to VS )
Open file from console?
emm blue links
Unity Console?
i want to make links like that
Application.OpenURL ?
Oh, make URL clickable in text
make blue link that will open VS and jump to line
make URL clickable in text -- > any tips on that ?
You need to look into the code, I forgot the name of the API used
(To jump to line, use https://docs.unity3d.com/462/Documentation/ScriptReference/AssetDatabase.OpenAsset.html)
ah
textWithHyperlinks.Append(lines[i].Substring(0, filePathIndex));
textWithHyperlinks.Append("<a href=\"" + filePath + "\"" + " line=\"" + lineString + "\">");
textWithHyperlinks.Append(filePath + ":" + lineString);
textWithHyperlinks.Append("</a>)\n");
that's how unity does it
i get it
" make URL clickable in text "
thanks
@onyx harness oh ok, I was gonna ask what issues I might encounter, it seems like a powerful thing
I'm currently trying to implement UI animation system, this attribute allowed me to serialize my IAnimation interface and I made a popup where you can choose from a list of animations + it draws default inspector for the one you choose
Have you worked on something similar, what can you suggest? How would you do it without SerializeReference?
@chilly stone Oh that's a big question.
It is definitely a big feature.
Not that easy to use, as I saw many people asking questions/complaining
about it.
But people who don't know how to use something easily complain...
Your system seems to work good already.
Without SerializeRef?
Keep a ref to the animation. (Like any normal Object field)
Apply an PropertyAttribute.
Draw the adequate PropertyDrawer of the animation.
It's like embedding an Object Editor. Actually what provides Odin.
@onyx harness great, thank you
The one big issue with SerializeReference is this: https://issuetracker.unity3d.com/issues/serializereference-serialized-reference-data-lost-when-the-class-name-is-refactored
I experienced it a few minutes ago lol
Doesn't look good right now, there are other limitations and bugs...
With each new problem I'm thinking to actually buy Odin, which will solve most of them
what is the best extension?
NG Tools obviously 😉
You're in the wrong chat
I have no idea
Mikilo was joking 
That's not it
Mikilo was joking :LUL:
@chilly stone Not even !
Just biased
Just biased
@waxen sandal Not even ! XD
Mik you said i have to change the tabcontrol to , no idea how to do that GUI.skin.button
@whole steppe when you draw tab buttons and want to change font size for example, you should apply a modified default style. Copy the default style like this: var style = new GUIStyle(GUI.skin.button);
Change a font size, and then pass it to the DrawButton constructor
Thanks i will try.
If you change GUI.skin.button directly it will apply that to every button in inspector, which you don't want I assume
i just want to change the Toolbar , yes
I never worked with toolbars sorry, Mikilo might give a better advice
@whole steppe what do you use to draw the tabs?
how do you do background tasks?
with like the background task progress bar
like the lightmapper does
That's not a background progress bar is it?
Is it possible to draw a rect with rounded corners in IMGUI?
@severe python For Unity 2019 or lower, this is what I use: (won't compile, but you should be able to fix it yourself)
https://gist.github.com/Mikilo/0f0c0549b264e6a4f7b43a2fe853949a
For Unity 2020 or newer:
UnityEditor.Progress
hi there, I have a script and I'm trying to do AssetDatabase.CreateFolder(..., ...), then later trying to verify if it exists with AssetDatabase.IsValidFolder(), but because Unity doesn't "see" the folder until my script finishes running, I always get false there
I've tried with Refresh and SaveAssets just after creating, but that changes nothing
what am I missing there?
I don't want to carry the GUID all the way to the other part of the code, basically
I'd like to be able to confirm if it exists without it
can I force a sync refresh or similar to achieve that?
Can't tell, if Refresh or SaveAssets aren't enough, maybe delay the execution of the code of one frame might do it
Mik i am using this to draw the tabcontrol
currentTab = GUI.Toolbar(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), currentTab, new string[] { "Main", "Interactable", "Options", "Prop", "Audio" });
@whole steppe The styles used are "left", "mid", "right".
sorry, default are buttonleft buttonmid buttonright
You need to reduce those styles
i have no clue how.
Try GUI.skin.FindStyle("buttonmid") and such
@onyx harness thank you
your gist up there just cores itself out if you're in 2020.x yeah?
What
your gist up there just cores itself out if you're in 2020.x yeah?
@severe python Yes. The new UnityEditor.Progress API is way too different from the old system. I didn't want to bother my self reimplement stuff
@waxen sandal wym
More like, what do YOU mean
@onyx harness arent the pictures clear
No
Click on the color and change the alpha in the color picker
Also that's a #💻┃unity-talk thing
@waxen sandal i didnt know where I should ask
Click on the color and change the alpha in the color picker
@waxen sandal and where is that
Where is what
@waxen sandal The Alpha u said
@onyx harness I'm completely confused how drawers work.
I have a drawer with a simple popup. It seems like there's separate drawer instance created for each popup item. Here's how I checked this:
private bool _value = false;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (_value == false)
{
Debug.Log("value is false");
_value = true;
}
// popup code
}
I assumed this is gonna be called once, but I was wrong.
This is called when I:
- Open inspector with the drawer
- Choose first popup item
- Choose second popup item and so on for each item...
Why does the drawer recompiles so many times when it should do that once?
@chilly stone Who told you that PropertyDrawer is unique and reuse?
@onyx harness I know that it's not unique, but it should be created once for each visible property, and for me it's doing that multiple times
I should also note that this happens only for PropertyDrawers that apply to attributes
Hum... perhaps a change in a custom class serializes it and triggers a reset
@onyx harness no way around it? How can I carry previously picked popup index?
You would like to know the previously picked? Hum...
Yeah because otherwise I would have to do this every frame:
Which is not very efficient. I want to set objectReferenceValue only when it's different from the previous
Ye
Never had to use it before
Yes, thanks, works like a charm
What's the difference visually except using and brackets?
I like to see indentations where they make sense
I'm not against indentation and brakets
For me Begins and Ends are ugly :p
but this compare to this:
BeginCheck()
GUI()
if (EndCheck())
DoSomething()
I find the latter much better
I don't see how it's better, in a big file you can't quickly find where the block is ending 🤷♂️
I never use Begin/End on big block, never
I only do if I have to fix someone else their code
Still the main advantage of using scopes is that you can return; at any point without things breaking
Your change check will
The weird feeling about the change check scope, is you have to execute the change within the scope
^
It doesn't make much sense
It's always done at the end anyway 🤷♂️
Yes, I give you this point, return is automatically handled
The best would be to provide a callback directly to the scope
Easy to implement
Scope can't exist outside of using, as it's destroyed
Stays fine to read
Efficient, i would bet not that much, but it needs some bench to confirm
I don't think scopes or begin-ends would be your bottleneck :p
Scope will call the callback on leaving if a change is detected
I am more afraid of garbage in this case
but I'm not even sure why I am afraid
Dunno about garbage
A callback will just be a simple delegate
Is there a profiler for editor?
Oh I only used it for checking game performance
Scope makes a new instance
Yeah and disposes it
Callback might need to capture a closure and allocate a new class
So there should be garbage I suppose
Not as efficient as the current implementation though 😛
The other problem is storing the delegate inside the scope.
Delegate assignation generates garbage
And since IMGUI can have a lot of calls, this trick loses its beauty
You need to do some benchmarks :p
Guys do you know how to make collapse (not foldout) the unity event field? I saw an image somewhere but cannot find it anymore. If you see my image the red line was the button to collapse. I don't want to use foldout if it is not possible with it.
No but I just remembered Event Trigger has same button there. I just need to make same way and code myself the show / hide behaviour. But it looks like a label with a button?
@rare surge I did something like this with Odin but can’t remember details - this was the overload I used though: https://twitter.com/timboc_/status/984542933348179968?s=21
Unsure if there’s an easier way to do it these days
Does anyone know how to make it so a window immediately sets one the fields drawn within as the GUI focus?
Nevermind, done.
Damn it was complicated. I found out They just draw the "-" icon over the unityevent field.
anyone know if Unity has a built in function to highlight a game object in the scene view? Use case is to hover over a game object and make sure the user knows which one will be picked
You could figure out how the selection highlight is called, though I don't know if it's at all accessible
of you could just use my selection plugin 😄 https://github.com/vertxxyz/NSelection
yea, I figured I could do it by hand by just iterating through all renderers/drawing an outline object...was hoping Unity had something 😦
cool plugin tho @visual stag 👍
Hi, can anybody explain how to draw animationcurve field with no stretching on both of its axis ?
for example, this and
this
looks very similar, but the Y axis is so far apart
how can i turn of the auto stretching of the axis ?
Anyone has an idea on how to copy files with their internal references copied as well?
Or am I just stuck having to go through everything using SerializedProperties?
@waxen sandal when you copy an asset, it comes with its references already, so I don't get your question
I mean if you copy multiple assets that have references between those assets, currently they point to the source asset rather than the copied asset
Nvm message disappeared
how do i make EditorGUILayout.CurveField non editable ?
GUI.enabled
umm, i still don;t get it
Replace GUI() with your curve field
oh, okay, let me try realquick
EditorGUILayout.CurveField(thisClass.expCurve,Color.green, new Rect(0,0, 100, 8000000) , GUILayout.Height(385));
there's no .Enabled
enable?
ah
There is really no trap
got it, let me try again
You just copy and paste and replace GUI() with your code
GUI.enabled = false;
EditorGUILayout.CurveField(thisClass.expCurve,Color.green, new Rect(0,0, 100, 8000000) , GUILayout.Height(385));
GUI.enabled = true;
so like this right ?
awesome, it worked, thanks for your help
@viral dune The best practice here is using a scope:
using (new EditorGUI.DisabledScope(true))
how do i use that ?
using (new EditorGUI.DisabledScope(true))
{
GUI();
}
My pleasure
Why this propertydrawer
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.PropertyField(position, property, label);
}
Is not working for UnityEvents? Is there other tricks to make it?
Can you show me the top of your file containing the PropertyDrawer?
This is the full code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace Maz.Unity.EventFramework
{
[CustomPropertyDrawer(typeof(CollapseAttribute))]
public class UnityEventCollapseProperty : PropertyDrawer
{
GUIContent m_IconToolbarMinus = new GUIContent(EditorGUIUtility.IconContent("Toolbar Minus"));
GUIContent m_IconToolbarPlus = new GUIContent(EditorGUIUtility.IconContent("Toolbar Plus"));
public override float GetPropertyHeight(SerializedProperty property,
GUIContent label)
{
return EditorGUI.GetPropertyHeight(property, label, true);
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.PropertyField(position, property, label);
}
}
}
Don't you need to put it inside EditorGUI.PropertyScope?
Where I need to put that? I made other property drawer as well but the propertyfield was enough
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
using (new EditorGUI.PropertyScope(position, label, property))
{
EditorGUI.PropertyField(position, property, label);
}
}
I guess Collapse is applied your field "GameEvent"
Thanks, didn't work :D
If I am using Editor script with custom inspector there it works just with EditorGUILayout.PropertyField(property); But I thought better to use propertydrawer since I use in different scripts.
@onyx harness yes
And you are right. Dump Editor and use PropertyDrawer instead.
PropertyField has a mecanism to prevent redrawing itself.
Let me explain
This is the editor version.
Is this from Odin?
No
Made by myself but with looking into the Even Trigger script. They just put a button over the unity event. I just reworked it little bit.
Well, UnityEvent has a built-in PropertyDrawer (PD) which draws GUI like in the gif above.
If you mark a field of type UnityEvent, you bypass the PD and use your custom implementation.
Inside your PD, when you use PropertyField, it will lookup for the proper PD.
But since the PD will be itself, it will infinite cycle.
The fallback is to draw "natively".
Better to visualize with that. This was made with editor script but yea propertydrawer would be better to be more flexible ^^
ohh ok
In my entire career of tools maker, I almost never used Editor
Neither PropertyScope.
I guess it has a purpose, but I've never had an issue without
Oh, interesting
So if I understand correclty so I actually would need to recreate unityevents pd?
Kinda yes
damn 😄
@rare surge a little off topic, what are you using to record those gifs?
ScreenToGif or such I guess
ShareX @chilly stone
Oh cool, I should get one :p
my biggest lifesaver tool
Has everything what I need. Many apis included like imgur to upload after the capture
Can it record in mp4?
Yes
Great
But for tutorials or similar things I wouldn't use it. Better to use obs there. I use it just to make quick recordings and upload to show quickly something.
Or generate yourself the built-in PD for UnityEvent
@onyx harness What exactly do you mean with generating? It sounds like extracting the code or generating the code.
I don't think you should neccesserily regenerate default PD, since you defined a PD for attribute, not for every unity event, right?
I was able to achieve similar by finding actual SerializedProperty for UnityEvent field and simply drawing a field: EditorGUILayout.PropertyField(property);
It doesn't matter - there is recursion happening, so you will have to find the SerializeProperty on a current drawer that is untouched yet, and draw it.
I did this in my SerializeReference drawer and it works fine
If you want a tip to start looking, the majority of the PropertyDrawer world is in ScriptAttributeUtility
No recursion will happen if you get the built-in PropertyDrawer
SerializedProperty and PropertyDrawer are 2 different worlds
Related at some point, but 2 different worlds
And by talking about SerializeReference, you were drawing it using its SerializeProperty (SP) and it draws the correct GUI, right?
@onyx harness yep, this is a drawer on an interface
So I draw background, label, etc, and then the property field itself
This is what I thought, and now can confirm, SerializeReference is not related to his problem
Hmm, I can try to make the same for a regular field 🤷♂️
Regular field or not
Using a custom PD is not related to the serialization
And you are working on a top object (your interface), not the direct UnityEvent
I'll try this for UnityEvent and get back to you 😉
You are getting confused with the word "serialize" 🙂
@onyx harness yeah you're right, I can't get it to draw default inspector for UnityEvent
But I found some useful resources: https://gist.github.com/AngryAnt/b5995c9b2cf2a0979758ad17f6a59ef0
can you make Gizmos' occluded ?
for example, I want this white overlay to be hidden by the tree standins
Hi i have problem
Debug.Log(object.activeSelf);
object.gameObject.SetActive(true);
Debug.Log(object.acitveSelf);```
Return me
False
False
```cs
Debug.Log(object.activeInHierarchy);
object.gameObject.SetActive(true);
Debug.Log(object.activeInHierarchy);```
Return me
False
True
But in both case object is still inactive in Hierarchy in editor, and in Game
Even i tried
```cs
Debug.Log(object.activeInHierarchy);
object.gameObject.SetActive(true);
Debug.Break();
Debug.Log(object.activeInHierarchy);```
And this was still inactive
theres full code https://hastebin.com/giyuhuquvo.cs
and reminder is selected in hierarchy
I'm manually drawing an ObjectField and calling Undo.RecordObject so I can use a property, but the change isn't serializing. The field changes in the inspector (in normal and debug mode) and undoing/redoing works, but the change is lost whenever the assembly reloads. Any idea why?
The property:
[SerializeField]
private PortalConfiguration configuration;
public PortalConfiguration Configuration
{
get => configuration;
set
{
configuration = value;
}
}
The GUI:
Portal portal = target as Portal;
...
// Draw Configuration
using (var check = new EditorGUI.ChangeCheckScope())
{
PortalConfiguration newConfig = (PortalConfiguration)EditorGUILayout.ObjectField
(
"Configuration",
portal.Configuration,
typeof(PortalConfiguration),
true
);
if (check.changed)
{
Undo.RecordObject(portal, "Changed configuration");
portal.Configuration = newConfig;
}
}
From what I understand, you can tell the change isn't serializing correctly because if you change the object reference with my custom gui and then switch the inspector to debug mode the field isn't bold and doesn't have the blue override indicator after changing.
But if you switch to debug mode before changing the object reference, the gui gets boldened and has the blue override indicator and the change persists entering/exiting playmode
tldr: using EditorGUILayout.ObjectField in conjunction with a c# property and Undo.RecordObject does not properly serialize the change
for example, I want this white overlay to be hidden by the tree standins
@severe python isn't gizmos drawn after?
Damn looks like I needed to also call PrefabUtility.RecordPrefabInstancePropertyModifications after making the change 😒
i guess that's what i get for making a deal with the devil and not using serialized properties
@restive ember it can be many reasons, not the right reminder, maybe another script
And your 2 examples make perfect sense, we just lack of information about them
@wispy delta Good job finding it
Has anyone here had issues with the editor not compiling code after file changes? I know it's not quite the right topic, but I suspect it could be the result of an editor extension.
@onyx harness theres no another object or script like this, also its work good at second and any next call function
Theres something strang for me
Does that work for gizmos?
god damnit, I think I got stuff confused
well, he could use handles instead of gizmos 🙃
Yes
It might work for gizmos, wouldn't surprise me if gizmos used handles internally
Not sure if this is the right place to ask but do you people use any good Logging asset ? something thast makes easier the task to debug errors on remote devices. Im using my own system but Im afraid we will need something better
well, when the game is running on other devices, somethinng that can store logs, and in case of need be able to check them somehow
right now im using Unity reports
so when i detect an error i send myself the last 500 unity built-in logs
but i was wondering if there was a more elaborated asset
and I have doubts like, for this ones to work currently im using debug.log, but i dont know if i should do that on release
i should simply store the lines of log somewhere i guess and not use the console
but then, should i also keep them on a file?
Oh for production
and be able to get them in case of a crash?
yes
for production
we are close to release
and i would like to have as much control as i can
you can store them in PlayerPrefs
It's a simple way to store data
Logs among others
Usually people use it to store game data
yeah i know, i was thinking to keep a text file updated but playerprefs might be faster
But at the end of the day, it can be anything
yeah im using it for settinngs
Maybe dont store 1GB of logs in there
hehe no
also i could make sort of flag i can activate remotely to get that playerPrefs log list
thats what i was wondering if possible
imagine a device in ..... mexico... crashes
and you dont know why
no exceptions
no errors
how do you get the log info
Either you send to your servers massively
Or you might need a system to handpick a device
maybe i could prompt the user to push some button and send logs
but what if the problem doesnt allow him to start the game 😅 shit
There might be services out there providing this kind of thing
Anyone know of a faster way to check a prefab for the presence of components other than PrefabUtility.LoadPrefabContents(); PrefabUtility.UnloadPrefabContents(); (takes ~0.5s for a prefab with a single object) - wondering if it's faster to parse the asset as text
AssetDatabase.LoadAsset works?
huh, it does? Hadn't thought to try that thanks.. will give it a go.
about 1000x faster 😅 - thanks! pays to ask
Be careful there is no caveat
LoadPrefabContents must have a purpose, i don't know what
I think it loads the prefab in editor - scene isolation and all that gubbins - totally unneeded in my case
@onyx harness yeah you're right, I can't get it to draw default inspector for UnityEvent
But I found some useful resources: https://gist.github.com/AngryAnt/b5995c9b2cf2a0979758ad17f6a59ef0
@chilly stone @onyx harness thanks The link was really good help. If I use thisUnityEventCollapseProperty : UnityEventDrawerso thebase.OnGUI(position, property, label);will show the default unity event drawer. Since my collapse function just draws a + or - over the field its done. No more code needed. The only last fix I need to do is I used GUILayout before with BeginHorizontal() in the Editor script. It is moved to bottom. Like in the gif base.OnGUI(position, property, label);
if (show)
{
base.OnGUI(position, property, label);
}
else
{
GUILayout.BeginHorizontal(style);
GUILayout.Label(ReflectionHelper.GenerateGenericTypesAsString(property), GUILayout.ExpandWidth(true));
GUILayout.EndHorizontal();
}
Oh the gif is bugged. It shows very dark field at the top. But its only in the gif lol. Compressing failed 😄
There is more code but its other things like checks if it is generic type or not or creating style
xD
But it works. I just forgot to add public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
I do this with it:
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
if(show)
{
return EditorGUI.GetPropertyHeight(property, label, true) + 20f;
} else {
return 0f;
}
}
Finally goal reached.
