#↕️┃editor-extensions
1 messages · Page 59 of 1
I am using Editor.CreateEditor(component).OnInspectorGUI(); to render it.
it might require that for some reason
Hrm, no idea then
can you serialize any value successfully? Or is it actually showing you the "can't drag" symbol
No problem serializing. Its just that I can't drag any Transform into it.
I have to do it through the inspector
This is so strange, I have no trouble referencing assets from the project window.
Technically what is being drawn in the custom editor is a prefab residing in the project window, but because the prefab is opened in the prefab editor the components there are being intepreted as scene elements even though they are objects from the project window?
Because other Object fields does not work either
I am just very sure I had it working at some point, but not sure what I have done to break it.
How do I detect the presence of a scroll bar in the PropertyDrawer script? My custom property get's cut off when scroll bar appears, so I assume I need to detect it and "squeeze" contents at the edge more in.
@quaint zephyr please don't cross-post. This channel is the correct place for these questions
Sorry about that, I usually don't, but recently my previous posts haven't been attended to and this channel been dead around these times 😛
The provided rect should shrink if the scroll bar is present, I don't think you should have to do anything at all
So it's in the way I coded it then?
perhaps, I'm not totally sure, but I think it should work fine
lol, I am writing for help because it isn't working fine 😛 I just screen shot and missed haha.
yeah, it definitely works fine here, so it must be how you coded it
What would be a conventional way of coding things like this?
just use the provided rect and it takes the scroll bar into account
And by provided Rect you mean the one passed in by OnGUI?
yeah
Ok. Thanks, I'll see if I can refactor my code.
@visual stag Thanks man. It's working good now
Is there a way to get the GameObject from the PropertyDrawer?
something like property.serializedObject.targetObject, don't quote me on the exact path names
that'll be the component/SO and not the gameobject, but you can take it from there
That's exactly right. I used that to get the component, however it does not inherit MonoBehaviour...
how do you mean? just cast it to component and then get the GO from that
Can you show me an example?
This is an example of mine:
var customClass = fieldInfo.GetValue(property.serializedObject.targetObject) as CustomClass
But I can't go customClass.gameObject because CustomClass is not a child of MonoBehaviour.
if I do
GameObject go = property.serializedObject.targetObject as GameObject
go is null
((Component)property.serializedObject.targetObject).gameObject
^will only work if the property is on a component, and will fail if the property is on an SO
Component in this case being my custom class script?
no, Component is fine
I need to be able to differentiate between a prefab and a prefab variant but I can't figure what method from the PrefabUtility class will do the trick. Anyone know which one to use?
And the second after I typed this, I went back to the PrefabUtility class and stumbled upon PrefabUtility.IsPartOfRegularPrefab which did the trick.
There's a prefab talk pinned to this channel, slide 48 has the functions you want
Is there a way of finding out what FBX Model a mesh is associated with? Something like FindFBXSourceForMesh(meshFilter.mesh)?
I just realised that Mesh derives from Object so I could just use GetCorrespondingObjectFromOriginalSource
whats the difference between
Rect optionsRect = GUILayoutUtility.GetRect(10, 10);
and
Rect optionsRect = new Rect(0, 0, 10, 10);
I stumbled upon another issue. PrefabUtility.GetCorrespondingObjectFromOriginalSource<Object>(meshFilter.sharedMesh); returns me the sub-object of a FBX and not the FBX itself:
@weak bone GetRect reservers that place in the layouting system
So if you do GUILayout.Button afterwards it'll be below it
Rather than inside
oh got it, thanks 😃
i display 2 input fields when a button is pressed , they appear at the bottom of available values displayed on the window , if i want the 2 input fields at the top... what should be done ?
@unborn bluff just get the asset path using asset database. That's the root object
@visual stag ah, correct.
Does anyone have experience with using UIElements.MeshGenerationContext to draw something on an editor window?
if so is there a way to draw on top of the visual element instead of under it?
I cannot help you sadly
Wouldn't the VisualElement that it is invoked for have a z-order or something?
Not that I'm aware of.
I might have an idea on how I can bring them to the front.
Make a new visual element which will be at top of the visual tree hierarchy and use that visual element to generate the all the lines.
I will try that for now
That sounds like how it'll work
Do you know how drawing order works in the visual tree?
Parents are drawn before children, siblings are drawn first to last in the parent
so if you want something to draw on top it needs to be a child of what you want to draw it ontop of, and/or the last child in the parent container
Yeah that's what I figured
I donno why I said I can't help you, I got confused by the fact that you're using this mesh thing I haven't seen before
which looks really useful btw
Haha
oh hey, I think I mentioned VisualElements to you before, I should let you know that I've updated the repo and the examples
As far as I'm aware, everything just works now, and if you're doing custom inspectors, then the only thing you have to do is make a UXML file matching the name of the Component you're inspecting
Cool I will take a look
I don't have a binding setup for things like buttons yet, but the system is greatly simplified now, basically you can just add ContentPresenter to anything, set its Binding Path and then you'll be able to automatically load templates by the typename, which works anywhere not just in inspectors
Custom Property Drawer. The values persist throughout Edit mode and Play mode. And they even persist if I Saved my scene and shutdown Unity and open it up again.
However, if I loaded Unity, changed the values (it doesn't trigger a asterisk near the scene to indicate it needs saving), so I can't "Save" the scene. And when I shut down Unity and restart it, the values revert to their previous state.
So the only way I can make sure they persist is if I made some change to the scene, like add an empty and remove it, and then I can save. Otherwise Saving without that asterisk, doesn't work either.
How can I "Save" the state of my values in the drawer without having to jump through this extra hoop?
And switching between scenes is the same thing as restarting unity. If scene wasn't able to be saved, values revert. If so, they persist.
is there a way to get a list of all open tabs / windows ?
I don't mind reflecting internal classes
Resources.FindObjectsOfTypeAll<EditorWindow>?
Was about to say I feel like I saw that you could do it like that
They do.
I was just flipping through the CS reference repo for an unrelated reason and came across this comment about the GUIView class:
// This is what we (not users) derive from to create various views. (Main Toolbar, etc.)
https://github.com/Unity-Technologies/UnityCsReference/blob/1093ded90f95fcced185a7c61393438ce65c749f/Editor/Mono/GUIView.cs
That is like the toolbar with the play/pause, buttons, and the transform tools I believe.
I know that the hierarchy, scene, project, and inspector windows all derive from EditorWindow. So I assume they all do.
That sounds right
I hope they can eventually jsut remove all the old IMGUI cruft and flatten the whole design
and then remove IMGUI from the code base, and pretend it never existed in the first place
because its the right thing to do
Ah, I see you've had to put up with searching through several-thousand-line-long code files for the place to change that one label text, only to have it break something a few hundred lines away too
oh no, I never got that far, I saw IMGUI for what it was an build scaffolding to minimize the amount of shit I had to do and then still hated it every step of the way since I knew exactly what I was missing from this GUI experience
I've been a professional WPF developer for 10-15 years approx?
so I knew how easy GUI work could be, and that IMGUI was making everything way more difficult than it should be
IMGUI was all I ever knew >.>
having said that, I've said it once, and I'll keep saying it, UIElements is ❤️
^
I'm a huge fan of WPF/XAML/MVVM, and I think UIElements has the potential to be better, its very close
UIElements single handedly ended my hatred of CSS as well
There's still value in immediate GUI, just not as much for anything production quality.
If there wasn't, then libraries like dear IMGUI wouldn't be so popular.
I mean, you can either get things done, or fight with a system that doesn't give you any convenience for layout
libraries for IMGUI are so popular because you had no choice but to use it, so everyone tries to get something that makes the experience not miserable
like NoesisUI which turned IMGUI into WPF
its like saying, people like Hospitals because they end up in them all the time
I'm not naïve enough to think no one likes IMGUI, I think many who like it don't have experience with something better and its what they are familiar with and so are suffering from a kind of Stockholme syndrome
I'm sure there are people out there who are experienced with UI frameworks and still like IMGUI
being able to just say something like
if (button)
DoThing();
is convenient for small stuff, but for full editor extensions it's awful
IMGUI makes certain programmatic problems simple, but IMO thats mostly because of alack of experience with good UI Framework Design patterns like MVVM or MVC
its just always easier to separate business logic from your display logic, and when you don't have the option to really do that, you don't
or you're someone like me who says "screw this" and then makes a framework that allows me to use MVVM or MVC like configurations
So yeah, i think people who like IMGUI overall just don't know better, I'm sure there are outliars who have the experience needed to make an informed opinion on why they prefer IMGUI over a more friendly framework
but if you've only used IMGUI and think its great, you just don't know why its bad
Take VisualElements for example.
I can make a UI for any Component in Unity with VisualElements that updates the value of fields and even has complex control where I need it, or completely custom layout
and that UI is literally only UXML
I can change the look without ever thinking about the acutal business logic of the thing I'm presenting
like if I want to customize Transforms look, I have the ability to do that by adding Resources\Templates\Transform.UXML
actually, woudl you like to see?
oh nm, we don't have streaming chans on here
I hope you don't think I'm making the argument that IMGUI is just as good for any purpose. dear IMGUI is popular for someone who just wants to be able to change their debug keyboard shortcuts into a toolbar or menu.
I actually donno what Dear IMGUI is, this is the first time I've heard of it
the most popular frameworks though are the ones that make IMGUI vanish
Noesis was popular enough to move off the asset store
It's not a Unity asset
oh its a c++ lib?
I'm not making the argument that Unity should keep its IMGUI implementation either.
okay, so point and case
"Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools"
this is the primary reason why IMGUI is bad
IMGUI's iteration time, is sinful
which makes it really hard to debug layout issues since it takes some 30 seconds to check out changes
There's nothing stopping someone from being able to add hot reload into this, it would just have to be specific to the engine running it and couldn't be implemented into the library itself.
oh is this not for unity?
That's what I said before
I'm talking about immediate mode GUI in general, not Unity
Sorry, I interpreted "Not a unity asset" as not on the asset store
oh I won't speak to in general, I only mean very specifically in unity
Like I said
I'm not making the argument that Unity should keep its IMGUI implementation either.
Unity's system falls apart for a lot of reasons, it doesn't mean IMGUI as a concept is universally bad
Sorry If I was giving that implication. I don't have the experience to make that assertion, I've only experienced IMGUI inside Unity, and so my opinion is based entirely on that
it's possible if I used Dear ImGUI I'd like it, but I simply wouldn't know
It's very similar syntax to Unity's IMGUI. It's more about the context you're using it in.
and importantly, Unity's IMGUI layout system is really hard to work with, so if they had better layout systems then it could make all the difference
if its very similar in form and function, while the iteration time would help a lot, I'd probably still find it aggravating to work with. Custom controls are non-trivial because of the way the event flow works
I haven't used it extensively, but I wouldn't be surprised if the layout system is better.
For someone who's just playing around with OpenGL directly, making a game engine or something like that, IMGUI can be very valuable.
Well, the issue for me would come down to templating and iteration
Just being able to make a toolbar is already valuable.
with something like WPF or UIElements, I can make a look for a Vector2, then re-apply that easily everywhere. I can modify it whenever I want and not even be concerned about if its going to break any logic, because it simply cannot
which is a small example, but that setup builds on itself rapidly
I have a type with 3 vector3s, I just add 3 of that template to a new template, and bam I now have a display for that class, oh I got a class which has a list of the previous class? I just add an iterating disaplay container (ItemsControl in VisualTemplates or WPF) and send it values from the array, bam now I got a big complex ui with a bunch of layers that I can change generally and update easily en mass
I'm not sure I can overstate just how powerful and useful DataTemplating is when combined with a good SOC framework for UI
I agree, UIElements is great once you get used to it (coming from IMGUI). However I think it's biggest weakness, especially when compared to IMGUI, is in the case that you only want to make a very small editor, like simply add a button to the inspector or something. It requires a lot more work then IMGUI does to do.
I wouldn't say a lot more work, if you're using only c#
if (GUILayout.Button(new GUIContent("Test))
DoThing();
vs
root.Add(new Button(()=>DoThing()){text="Test"});
no it doesn't @gloomy chasm
You're going to make an IMGUI Container, and then call the base inspector call from within that
Idk why I never thought to do it like that. I stand corrected.
to be completely honest, this is a guess, but I see no reason why it shouldn't work
from what I recall it should just work
Both what you said and Legend seem like it would work.
My framework actually makes it more difficult surprisingly
that said, you could make a template that specifically adds stuff to the default inspector and is able to do so purely through instantiating uxml
Hey, is there a way to toggle grid snapping on and off through code?
I'm making a tool that needs this feature
but can't find where in the API is that functionality
@waxen sandal woah
that worked
used the same line but Object.Find... got 0 results back
resources give me valid output for some reason
thanks
Object & Resources are different. That's why.
Yeah, but why would resources return editor windows that currently exist?
I thought it was only for loading things out of Resources folders
Unity uses the Resources class for keeping static methods related to in-memory asset stuff
There's also Resources.UnloadAsset which can be used to unload any asset, not just ones loaded through Resources.
Resources accesses entities from both Runtime & Editor, not just runtime.
The runtime is in the editor too, so I'd call running in playmode in the editor as runtime too
I understand you are still talking about runtime (in or out of Editor)
I am stating that Resources gives access to any created Object
(EditorWindow and such included)
Yeah, you're right. I changed it to in-memory assets rather than runtime assets.
Because it won't give you access to assets in a build unless they've been loaded into memory.
And I guess the word asset is also not accurate.
They really shouldn't have stuffed all this into Resources.
Is there a way to make a custom component move to the top in the inspector when added?
@pure sand
I think I've got it figured out now, thanks for the tips.
hacked
custom skins ?
If you want better scaling
Custom skins is not that hard either
with UIElements UI Toolkit custom skins should be a trivial matter
seems to scale only local GUI scope
interesting thing that GUI.matrix
where in the gif above its scaling the whole editor
( increasing the font sizes to be more precise )
Yeah but you can change the scaling of other editor windows if you do reflection magic
@waxen sandal not sure i am missing something but there is no matrix in EditorWindow
https://github.com/Unity-Technologies/UnityCsReference/blob/1093ded90f95fcced185a7c61393438ce65c749f/Editor/Mono/EditorWindow.cs
You're not but that doesn't mean you can't fix it 😉
do you mean to say there is a way to extend an existing method in C# ?
sort of code injection ?
I don't feel like thats what he's suggesting, but I donno what else he would be suggesting
you can, with mono.cecil
It kind of is what I'm suggesting
But was intentionally being vague to let him research it on his own 😛
And with UIToolkit it's pretty easy to do better scaling as well
IT's also not hte only way to edit methods
tbh, I think the best approach is going to be through UI Toolkit's USS files now, hopefully you can dot hat
tbh, I think this whole editor skin for "pros" thing is stupid
like, straight up dumb
I've managed to "hack" the editor to let you get the dark skin for free by manipulating editor styles 😛
lol, I'm pretty sure thats the standard among the community, hack the client to get the skin
I'll just make something to replace all the editor styles
Well lots of people just edit the exe
build my own theme engine
it wont work completely though, they haven't migrated over to 100% uielements
I've thought about that but it was too much effort 😛
its not worth the effort yet imo
I wonder if they'd let you deploy a theme manager to the asset store
Well
I feel like the answer is no, and that is really dumb
simply because they positioned the theme as a pro feature for some hairbrained reason
I did have permission from Caitlyn to publish my "hack" but then when I actually did it was declined 😦
I donno who Caitlyn is (I donno any of their names tbh)
She used to be the Asset store manager
I know who a few of the UI toolkit guys are on the forums by their forum name
Or w/e her title was
@waxen sandal you should publish your "hack" on github, so people can add it through the Package Manager 😄
I doubt it works all that well anymore
And it's on the edge of being breaking the TOS
slap a Disclaimer and move on 😛
Yeah rather not kill my career 😉
can we start a petition for them to pull their heads out of their rumps with the theme?
Isn't there one?
honestly, locking a theme behind pro stifles the community innovation
and really, makes it so that we can't have a global theme manager allowing people to build blendable themeable extensions
perhaps that will be changing when they finish up their migration to UIElements
Yeah they've seemed to be a more open nowadays so it wouldn't surprise me all that much
woosh
Hi there, I dont know if I'm in the right chan but I try to record video with cam-recorder and I get this error msg :
FMOD failed to switch to output recorder ... : "An invalid object handle was used. " (36)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
We are using Wwise and not the unity audio engine :/
Can Event.current in editor scripting detect multiple inputs at the same time ?
If I want to spawn object after a button is being pressed (on hold) and a mouse click.
EventType don't contain a definition for KeyStay it only has KeyUp and KeyDown.
What can be done to achieve this mechanic?
Anyone know a typical way of implementing "selectable" stuff and having it work with USS without having to bend over backwards? I saw the "selected" pseudo-state is apparently unused...
Apparently there's special handling for Toggles, but it only works with Toggles according to the docs
Not sure if this is the right place to ask but does anyone know of a way to build single asset bundles seperately?
currently i have this little class that lets me build all asset bundles in one click
but whenever I do it I have to copy and paste backups of all the old assets I deleted back into the project otherwise the existing asset bundles will be overwritten with nothing
nobody use Unity Recorder combine with Wwise ???
hmm, how would I create a prefab without having to create a gameobject in the scene? I have a collection of SO that are managing data but I need to add some functions to them from an interface. afaik its not possible to add functions to scriptable objects, so I create prefabs that reference the objects and update their data whenever a change is made
I didnt mean methods internaly in the script. I mean unityevents actually @waxen sandal
im aware I cant add components, since they arent a monobehaviour
They technically are monobehaviours but lets not get into that
Not sure you're able to create a prefab without a GO in the scene
But you can write a script that creates one for a bit and then destroys it after you created your prefab
that is true, I could solve it like that. or I could look into generating the actual prefab asset file? or is that overkill?
Probably overkill and you might end up generating something that only works in the current version of Unity
good point, if the prefab system changes that code might stop working
Unity is suppose to correctly migrate between the different serializers
Jusy FYI there’s also a concept of using ScriptableObject assets as events (similar to how the Timeline signals work) which can be a nice way to bridge SO assets and monobehaviours
@onyx harness I'd assume that is only run on project upgrade rather than on import of assets?
i havent heard about that @split bridge do you have any resources on that?
I think it is on save @waxen sandal
Ah, then it probably won't be an issue
Because you can easily import old prefab into recent version
There’s a great talk by Ryan Hipple which I’ll try and link but you can also try googling creating events with Timeline
Scriptable Objects are an immensely powerful yet often underutilized feature of Unity. Learn how to get the most out of this versatile data structure and build more extensible systems and data patterns. In this talk, Schell Games shares specific examples of how they have used ...
I've got a repo that implements the scriptable object architecture that he describes
But it's a bit outdated
Made in 2017.2 iirc
gonna try and see to figure it out myself 😄 I would like to know how it functions more so than just using it
Sure but it's open source so you can just look at the source 😛
that would also work lol
If you have any question, you have this Discord
Yea the concepts in that talk are quite dense - for your purposes basically all it would be is a new type of SO with a few methods - something like ‘register’ and ‘unregister’ calls which populate a static array. Then an invoke method which invokes all corresponding actions in the array. Smth like that.
that makes sense, wonder if i can do that with unityevent properties. or should i just be using delegates and make a selector for my own functions? I would want to constrain it so only applicatable functions can be assigned
they do but I want to only show my functions in a selector, which is not something you can do in a unityevent selector
like if i make a static class that has 5 functions that can be assigned to the SO event, can i make it o the unity event only sows those 5
oh
fair enough
they are static void functions in a static class, and I would like my SO unityevent to only show those
you mean an attribute on the functions that allows them to be shown for the selector, correct?
I havent rly worked a lot with propertydrawers so i should do some research on those. @onyx harness
you mean an attribute on the functions that allows them to be shown for the selector, correct?
@steady crest it's a way
I havent rly worked a lot with propertydrawers so i should do some research on those. @onyx harness
@steady crest do and then ask in here
I will wait for your request brave adventurer
fair enough, doesnt rly make sense asking questions before doing my own research 🙂
contrary to the belief of many on the server cough #💻┃code-beginner cough
Because my realm is Editor only
Does anyone know something about this error message?
NullReferenceException:Object reference not set to an instance of an object
UnityEditor.DockArea:OnEnable()
Googling this message doesn't really provide me with much info and the console doesn't provide any info about which line it happened
Yeah it's been happening for quite a while now
Occasionally it's worth resetting your layout - i.e. Window->Layouts->Default
Just did and the message popped a few seconds afterwards
Well if it doesn't happen in a blank project I guess at least you know it's likely from your or a 3rd party assets' code somewhere 😅
Yeah it's probably caused by something in your project, it's just impossible to track down what 😛
that's what source control and the delete key are for 🤣
Yeah I know that is was caused by my code.
I will see if I can track down what it is
Ah ok - well just in case it helps - sometimes there's a little more in the editor log to help track it down (Console->Hamburger->Show Editor Log)
@waxen sandal where is that repo, I'd like to take a look
Lemme DM you, don't want to paste my private stuff all over this Discord 😛
Ehh, you gotta add me 😛
Does my posting of my private stuff all over discord bother you 😛
Not at all 😛
I just don't want to have my shitposting be linked to my professional github
Anyone know if there's a way to draw a custom Editor/Inspector when nothing is selected?
I'm usually writing into a static variable or a private field of the Editor
If you're using UIToolkit (The framework formerly known as UIElements) then you're looking at View Data Keys
I'm not but actually I will maybe convert my UI to it! Thanks
If you'd like to, I love it, and am happy to help others get going with it
@lucid hedge SerializedProperty has an .expanded field, you generally highjack that
@severe python I've only used UI Elements for editor windows
or well UI Toolkit
never for inspectors
and @visual stag uhh I'm using it like this
The toolkit formerly known as UIElements
but using 'private static' for that variable 'showInteractionSettings' worked
and yeah haha I prefer UI Toolkit honestly
I just wish they could completely sunset the old systems because its honestly confusing at this point
I understand that thats not feasible or even reasonable, I just wish it was
I wonder if they include UI Builder in as part of the "UI Toolkit"
I'm not sure how the context of the code helps. If you have access to a SerializedProperty you can use the .expanded field and save it as usual
I'll look it up
I’m using EditorGUILayout.BeginHorizontal(); and EndHorizontal(). I want a space of a specific pixel width, between some EditorGUILayout controls in this horizontal section. But calling EditorGUILayout.Space(3,false); puts a space far larger than 3 pixels into the section.
I tried to find weather or not the “width” parameter specifies pixels or some other units. But I don’t even SEE a variant/overload of the Space function that takes ANY parameters in the docs (I found the overloads via VisualStudio intellisense). https://docs.unity3d.com/ScriptReference/EditorGUILayout.Space.html
Is it possible to specify a specific horizontal space size with EditorGUILayout? If so, what am I doing wrong.
I'm trying to setup a project for people to download, and I want to launch a setup when the project starts based upon whether or not a DLL exists in a specific folder.
If I wanted to do this, what options are there for executing a piece of code when the project opens?
nevermind, I remember, InitializeOnLoad
@keen pumice use GUILayout.Space
@onyx harness alas, I get the same huge horizontal offset with GUILayout.Space(3);
Aw crap. I have an issue, need some guidance on this one I have no clue how I could do this
I have a library from a game that I depend on, but obviously I can't ship my code with that games library, so the user has to supply it themselves. I wanted to make this easy by checking to see if the library is in the project's assets and then opening a file dialog for the user to load the file into the project with.
The problem is my code wont compile without that library, so I need to conditionally compile that code based upon whether or not that library is present.
Is there any way to even do that?
Is this in the editor?
If so when you launch Unity the first time it does a different compile
Rather than failing everything if there is an error anywhere
It'll try to compile each asmdef separately
So things like the PackageManager and code tool integrations still get compiled
so If I restart Unity, it should do it
lemme try that
I did section off the auto-config into its own assembly thinking that might resolve it
haven't restarted unity however
Yeah that should work if it doesn't depend on that library
w00t
er, that means it worked
@onyx harness creating a simplied example GUILayout.Space(3); DOES work properly, even though EditorGUILayout.Space(3); doesn't. So, obviously I'm doing something else wrong in my non-example to get diff results - thanks for the tip! By the way.. any idea WHY it only works with GUILayout version and the EditorGUILayout version doesn't?
Dunno, I never used the Editor version
okay, is there a way to change the settings on an assembly file, the meta data
The problem is my code wont compile without that library, so I need to conditionally compile that code based upon whether or not that library is present.
Is there any way to even do that?
@severe python one option would be to put that particular set of code into it's own dll. meaning-- YOU compile it, and distribute that, rather than source code (so the user of your software does not need to compile it).
(I see you got an answer to this already, just wanted to present a different option)
I'm actually getting things setup for a compiled release version of my project, but I want the source code based version to work as well for those who want that environment, whatever the reason may be
So that part is all taken care of now, I can have a dialog open to copy in and configure the libraries when the project loads
Now, I need to build an export pipeline, which is just constructing AssetBundles from some data in the class.
Does the programmatic AssetBundle interface deal with dependencies, or is that specifically a feature of the AssetBundle Browser?
nm, I can look that up
okay, is there a way to change the settings on an assembly file, the meta data
@severe python SerializedObject
?
I solved it by just writing the meta file completely when I pulled in the assembly
but I don't understand why you mention SerializedObject
Manually writing a meta is not a sustainable way
all I want to do is turn off Validate References and Auto Reference for the assembly because its not necessary, is there a way to do that?
this is how I'm doing it currently
I never tried that before, but I guess there should be an easy way
ts good enough for now, the game is on 2018.4 LTS and probably isn't going to be changing versions, so I don't suspect an issue
UnityEditor.PluginImporter is the importer used, it should contain the data you requested
ahh, thank you
hmmm, don't really understand how to make use of that
nm, got it, htanks
Actually that doesnt seem to provide this. The only thing that appears to fit would be, setEditorData, but using it doesnt so anything
you have DefinesConstraints and isPreloaded that are public
but IsExplicitlyReferenced & ValidateReferences are internal
but to be honest, in this case, I would prefer to use SerializedObject
And iterate using a SerializedProperty to set the data
not sure this works
In my opinion, SerializedObject is the most reliable way of altering any Object
But to be honest
yeah, when I try to new up a SO on the importer it just blows up
ts good enough for now, the game is on 2018.4 LTS and probably isn't going to be changing versions, so I don't suspect an issue
@severe python If it works, it works
don't bother yourself with alternative technique
As you stated, you are going to stick to one version
You don't wrap the importer, but the asset itself (in your case, your assembly)
so that was my original intention, but I have no idea how to get the asset honestly, and that feels dumb
maybe I'm just convoluting this in my head
Is it still true that there are no serializable [Flags] Enum that is visible in the inspector?
Where is the asset humanly speaking?
Like with LayerMask?
Assets/Assemblies/Assembly-CSharp.dll
In Assets? O_o
if you mean because its Assembly-CSharp, its a modding situation
If not, I don't understand and feel I should be educated on why I'm stupid
You just do AssetDatabase.LoadObjectAtPath<Object>("Assets/Assemblies/Assembly-CSharp.dll")
Anything is an Object
Any asset is an UnityEngine.Object at the very base
You can't work with an Object. But a SerializedObject can.
A little helper to debug a SerO:
public static void OutputHierarchy(this SerializedObject so)
{
SerializedProperty it = so.GetIterator();
while (it.Next(true))
PrintProperty(it);
}
private static void PrintProperty(SerializedProperty it)
{
if (it.propertyType == SerializedPropertyType.String)
Debug.Log(it.propertyPath + " " + it.stringValue);
else if (it.propertyType == SerializedPropertyType.Integer)
Debug.Log(it.propertyPath + " " + it.intValue);
else if (it.propertyType == SerializedPropertyType.ObjectReference)
Debug.Log(it.propertyPath + " " + it.objectReferenceInstanceIDValue, it.objectReferenceValue);
else
Debug.Log(it.propertyPath + " " + it.propertyType);
}
yeet
There are things that are kept hidden.
To display them, you must set the mode of the SerO to internal instead of normal (Through Reflection)
the InspectorMode?
This one: inspectorMode = InspectorMode.DebugInternal
Yep
but use this one only if you really need hidden stuff
otherwise just do your things
hidden stuff like m_Script and such
meh, that doesn't work for me, I'm probably making a mistake, but screw it I'm just gonna use the ahrd coded setup
Is there any documentation for the Experimental.UIElements.GraphView other than the API reference?
There's a tutorial pinned to this channel (not official)
anyone got vsc extensions for hints/autocompletions in unity?
@whole steppe The channel is about extending the editor. You are looking for VSCode Editor support package in the Package Manager.
oh alright, thank you
@visual stag Thanks, that helped a lot, much better than nothing
using an EditorGUILayout.PropertyField
is it possible to control the spacing? So there is enough room for the text
@lucid hedge Maybe increase EditorGUIUtility.labelWidth before drawing the field?
That seems to do the trick! thanks
Does anyone know if it's possible to enable the rect tool for a custom script and get callbacks when the value changes?
I'm looking to basically generate paths from my own custom system, not using splines, can anyone point me to what I can use to be able to display them in the editor? For debugging purposes, paths that are basically just Vector3 points connected by a List or array.
Heyo everyone!
Is there a way of changing an AnimatorController NOT during runtime via scripts?
Current code, that falls apart as soon as I play the scene:
public static void AppendController(AnimatorController controller, AsepriteImporterInstance importerInstance)
{
Animator potentialPreviousAnimator = importerInstance.TargetObject.GetComponent<Animator>();
if (potentialPreviousAnimator == null) importerInstance.TargetObject.AddComponent<Animator>();
Animator animator = importerInstance.TargetObject.GetComponent<Animator>();
animator.runtimeAnimatorController = controller;
}
@whole steppe what is the rect tool? Do you mean a Monobehaviour that has a Rect field?
@opaque harness you can look into Debug.DrawLine or Gizmos or Handles depending on what UI you're after
@split bridge it's one of the editor tools along the top of the screen (like translate, rotate, etc), it provides a manipulable rectangle
with a 3d cube selected you can use it to resize the cube, which is pretty handy. I'd like to be able to do this with some script components as well
for example to resize a tile grid
ah that one - I'm 99% sure it's possible but I don't know the syntax off the top of my head
@waxen sandal yeah, hence the issue. It's a bit silly that you can't make editor tools that change animatorControllers on objects. I mean, I added a prefab object onto this tool and it worked---sometimes?
I'm not 100% sure on what's the fix. And googling didnt help 😐
Resolved, sort of:
Works if the target object is a prefab, but not if it's a scene object
does anyone know if there's a callback on specific serialized objects when an undo state is applied to them?
I have a thing that needs to match the state of serialized properties, and it works in general except I don't know how to detect when you undid something on it
@blissful burrow Undo.undoRedoPerformed I think is what you'd need? 🙂 - If it's just for specific SOs I guess you'd have to check within that editor-level callback
I want to avoid having that be called for potentially hundreds of objects in my scene
I feel like there has to be a per-object callback, somehow, or a cheap way to detect it
hm not that I know of - report back if you find something? Guessing you can't catch the modification at the point that they are modified?
if that makes any sense 😅
mmmmmmaaaaybe but the location of that gets, messy. I can't have a static list, since that'll get dumped if you recompile your code and then undo to a state before that
so I'd need to serialized the pointers to what objects were modified
and how many times
:c
I guess I might just update all for now, just feels scary to just, do all the things in the scene
oh right heck I already have a solution for this
theoretically I should just make it match the data in OnValidate
since that is called after an object has something undone
but!
there's a bug (I think?) in Unity where assigning to a mesh filter in OnValidate throws a really weird warning about how SendMessage isn't allowed
this lil hecker
That's a nuisance
it's super weird
Maybe have to resort to a delayedcall?
it's also not great that it's marked as fixed https://issuetracker.unity3d.com/issues/unity-throws-sendmessage-cannot-be-called-during-awake-checkconsistency-or-onvalidate-warning-when-manipulating-the-ui
sorry not being v helpful and gtg.. good luck!
no you're fine! thanks for the help
not sure if I should hack around it or leave it there and just deal with all support messages by linking it to a bug report for Unity 🙃
oh gosh okay it happens when saving the scene too
Related to this. I'm not sure if it's a good solution or a solution at all though. https://forum.unity.com/threads/in-unity-2018-2-6f1-trying-to-set-sizedelta-in-inspector-using-onvalidate-throws-warning.550396/#post-4698131
ah geez, that's gross :c
thanks for the link though, might help
why do I have to do this unity pls
having hundreds of in-editor update loops to fix this seems like a nightmare
People may go to extremes to have clean logs 😄
me: hmm, maybe it's fixed in 2019.3.7
unity:
I want to try to test if the execution can be outsourced to Editor supported Coroutines instead of the Update to run just once and avoid running things inside OnValidate. (without triggering the message)
If coroutine is being started by OnValidate it throws the same message. Otherwise it works just as well as Update when it already runs 😦
Ha! It works if you skip one first frame.
I'm looking to make an editor script that automatically unpacks prefabs completely when I drag them into the scene, does anyone know where I'd even begin?
I know I can have a script constantly running that detects and unpacks them, but ideally I'd want to hook on to the function that runs when a prefab is dragged into the scene. I just don't know how possible that is.
@rancid cave There's the EditorApplication.hierarchyChanged event, but unfortunately it won't tell you what changed
Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
Just installed it at https://www.microsoft.com/en-us/download/details.aspx?id=55168
I still get the error
Download archives for all versions of .NET - past and present. Get downloads for all versions of .NET Framework and .NET Core for Linux, macOS, and Windows.
@deep lava This is a channel about extending the Unity Editor. And you just need the latest targeting pack. You can ignore others, everything lower is included.
@stark geyser Oh, I thought it was about it, sorry
anyone happen to know how to get a VisualElement's rect to be centered about its transform position?
Is it possible to maximize the game window? As in, no border kinda max?
https://assetstore.unity.com/packages/tools/utilities/fullscreen-editor-69534
I found and it's 20$..
shift space?
It's about it being totally fullscreen.
I've used this one before https://assetstore.unity.com/packages/tools/utilities/editor-window-fullscreen-85477
Though no idea how it compares
feels like they're all a bit hacky
I'd imagine it works something like, they drill down with reflection to the tab, undock the tab, use win32 to get the window, then full screen it?
nah, theres got to be a bit more to it
@onyx harness you mean ^ ?
I migrated my project from Unity 2018.3 to 2019.3.7f... Every single UnityEvent in my project throws errors that the UnityEventDrawer has a problem with a null pointer exception
Any idea why this happens and how i can fix this ?
Would be great if anyone could post their EventDrawer... probably mine wasnt upgraded
restart Unity before doing anything else - sometimes upgrading can temporarily cause references to be lost @silver spruce
@split bridge did that several times... still that EventDrawer issue :/
Could really need some help with this here, my whole app is pretty UI Heavy and now all Events are invisible due to the EventDrawer
oh I just more closely looked at your code - trying to process how that's supposed to be working - 1 sec
@split bridge Thanks ! Actually not my code... this is the part of the UnityEventDrawer which throws the exception
hmm that's really odd
my guess is that 'prop' is null when passed to that method but I have no idea why - I suggest looking at the stack trace and trying to work your way back through the code - also this probably belongs in #💻┃code-beginner or #💻┃unity-talk perhaps
@split bridge Thanks ! They say i should properly delete my library folder for generating new librarys ^^ im gonna give that a try
@oak grotto Don't cross-post, this has nothing to do with extending the editor.
@stark geyser So i deleted the whole library folder... reopened the project... and the issue is still here :/ its getting weird
What is the component not being displayed?
@stark geyser The UnityEvent... everywhere in the code base... Buttons for example dont render their UnityEvent OnClick :C
I googled for similar issues... but havent found a solution yet...
try removing and adding a new one
Did that several times... the same result... The UnityEventDrawer throws null pointer exceptions when it tries to render those events
But in a new project it works perfectly well?
My UnityEventDrawer is located in : Assets/Editor/UnityEventDrawer.cs is that correctly ?
Yep @stark geyser new project works fine
It's unlikely that is the problem with editor scripts. Your project just probably somehow tries to use outdated libraries or references
No fucking way... how the hell did the unity event drawer end up there ?! I deleted it and boom... the events are getting drawn correctly... @stark geyser Im sorry for wasting your time, looks like that script somehow ended up in the wrong place :/
@civic lotus mean what exactly? I don't get it
im sorry a quick question but why is a [SerializeField] private list not shown in editor?
while a public one is?
i am aware dictionaries per example are not serializable but lists as well? i didnt find a relevant doc about it anywhere
unity version 2019.3.5f1
Lists are specialized to be serializable
so it should show up, but I'm not sure why its not in this case
weird hmm
i mean its not something someone can mess up easily so i was curious about it
i did try per example a serialized integer
but lists dont work
it might be a quirk I'm unaware of
no compile errors
since i am not using it yet in anything
its a simple new script
and i wanted to test some things
so i simply added a public list before i do anything
and i noticed so
i should note though if thats the issue and my current hypothesis is that im doing this under a namespace
aka namespace smth (for now)
So if thats the reason thats happening how do i avoid this so?
but i dont believe this would be the issue, or atleast dont know it could be so
also please @ me in future replys so i can notice a message was posted
hmm
well in monobehaviour i didnt see any issues
could it be from networkBehaviour? // using mirror
i am afraid i cant really post any code, its not a personal project and my employer has strict restrictions about code resharing
do pardon, if this makes this an inability to receive help then, ill just brute force it
cant really make exceptions for this
although for some reason i tried this around
and i kept it as serialize field and restarted unity
and it did work for now
so possibly an issue with some outdated component in the project or something else dunno
well either way
Anyone know of any good gamepad/input controllers for in-game menus?
Trying out some more complex UI's that just a square grid, but the native gamepad functionality with buttons are just bad.
Otherwise I'll just make my own if there are no public ones around, just don't wish to spend time inventing the wheel again if I can avoid it.
This channel is for creating extensions, so you can ask here when that's the case. Otherwise, probably #💻┃unity-talk, maybe #📲┃ui-ux
It's flexible.
@onyx harness it change the Unity Editor color
calling EditorGUI.Foldout with a rect parameter that has a width of 20, but it's not clipping the label to 20 pixels.
So, I tried creating a custom style, like so:
fixWidth.fixedWidth = 20;```
and passing that to the EditorGUI.Foldout function.. and while this does clip the label, it does not draw the foldout icon.
which GUI.skin SHOULD I use to start with? I couldn't find a GUI.Skin.Foldout option. Or should I be doing this a different way?
update: I found the EditorStyles.foldout GUIStyle. But, unexpectedly, setting the fixedWidth=20 seems to have no effect on the foldout's label.
Anyone know a way of getting all the VisualElements under the mouse?
without, you know, querying and testing all of them
tysm
you're very welcome sir, good luck and Thank you for using UI Toolkit!
Good Luck, and if you need any help, feel free to ask
(and remebmer me in the future when you make a sweet asset :D)
Learning how to inject stuff in this sweet spot ! 🌪️
Revamping NG Hub (https://assetstore.unity.com/packages/tools/utilities/ng-hub-free-101011) with modern technique
into the blue spot?
Yep, done already, there is a EditorGUI.DrawRect drawing blue as a test
Is that area all UIElements now?
Nope, I see a IMGUIContainer
i think entire editor is UIElements (with mostly IMGUIContainers) everywhere now
even the scene view is
pretty cool that you can just add an uielement onto the sceneview to use as overlay
Sounds promising indeed
IIRC every window is wrapped in a UIToolkit/elements container
So it should be easy to just add an extra element that draw on top of everything
you can drop ui elements over the scene view?
sceneview has a visualelement as root yea
so if you get a reference to SceneView for example by SceneView.beforeSceneGui callback (or some other way i guess)
you can do sceneView.rootVisualElement and add your own visual elements to that
and it'll appear on top
Waaaat that's awesome
You can pretty much inject anywhere
Here I am offering help
Does someone know how to access the current drawing EditorWindow?
From a ui elements context?
From a VisualElement yes
As far as I've found you have to pass that data in
Visual element does have a user data field
Sorry on my phone its. Autospacing everything and I've given up
If you're familiar with wpf, user data functions similarly to datacontext
There is a FindAncestorUserData method, which will search up the visual tree for a populated userData field and return it
I've used that previously to provide the editor context to my uielements, though I moved away from that
Seems... a lot of issues in the long run X)
Hence why I moved away from it
It tightly couples your visual element to editorwindow or some specific derivative
I still use UserData, but I dont look for anything specific, and I get properties and fields off that UserData based upon fields in my element
I realized I dont need to know the type if I'm expecting the developer to know what they are putting in and trying to bind to
What are you trying to accomplish exactly
If you don't access the EditorWindow, how do you force a Repaint from a VE?
Why do you want to repaint?
Because I updated the data from an external source. And would like the window to be up to date
So that suggests to me, and correct me if I'm wrong, that you're populating visual data manually in code, rather than using the binding system available
and that could be due to the fact that you're not necessarily connecting to something that is a UnityEngine.Object and therefor not representable by a SerializedObject?
I'm not even using UI Toolkit for real, I'm still injecting IMGUIContainer
oh
Which excludes binding yet
so you're doing most of your drawing in the IMGUIContainer, and you need that to repaint?
I can't say I know anything about IMGUIContainer tbh, I moved to UIElements specifically to get away from imgui
I would have thought that IMGUIContainer would run gui code like normal
It would be, in a normal context
hmm
My best guess is that, there is probably an event somewhere you can hook to to invoke an update to the imguicontainer?
like EditorApplication.update
I'd bet theres a paint event
When I inject my IMGUIContainer in the spot I showed above. I don't inject in an EditorWindow.
It is in a Toolbar.
Toolbar derives from GUIView.
EditorWindow are contained in a HostView which derives from a GUIView
Therefore, when I extract the Toolbar, I have unfortunately no EditorWindow
Then why are you looking for an EditorWindow?
I was hoping there would be something in there, until I realized there is none
So now, I will just extract the GUIView and repaint it and hope it works
I can tell you that UIElements don't update in the same fashion as imgui, only things that change get redrawn
you make me want to work on VisualTemplates**, but I'm not sure what there is to actually work on except documentation
Hum...
I made it work, but clearly your concerns must be addressed for the long run, interesting, thanks for the intel !
is it possible to make an assetbundle at runtime?
Not that I know of
Getting this error while i try to download a package from the manager.... no firewall is up and no proxy is used
Any idea why this happens ?
I also wanna mention that i only see the old versions of this package, newer versions dont show up, even if they are already released
sorry to ask the same question as yesterday guys- I'm just stumped by this- not making any sense to me: I have the following test code in a CustomProperty drawer's OnGUI GUIContent newLabel = new GUIContent("FoldoutTestNormalWidth", "testc"); EditorGUI.Foldout(position, false, newLabel, true); position.y += 20; newLabel = new GUIContent("FoldoutTest20Width", "testc"); position.width = 20; GUIStyle fixWidthFoldout = EditorStyles.foldout; fixWidthFoldout.fixedWidth = 20; EditorGUI.Foldout(position, false, newLabel, true, fixWidthFoldout); newLabel = new GUIContent("LabelTest20Width", "testc"); position.y += 20; EditorGUI.LabelField(position, newLabel); but this ONLY limits the width of the last field (the label), but NOT the width of the second foldout... Any ideas on what I'm doing wrong?
no idea man, not too familliar with this stuff. Have you tried using more than one newLabel reference? maybe reusing the same one has adverse effects
will test now.. alas, same result. Thanks for taking a look tho!
rect position still has width 20 when you place the last label
did you try EditorGUILayout.Foldout ?
This is for a property drawer, so, EditorGUILayout wont work in there 😦
ah ok
that said... I AM able to limit the width of those by passing in a EditorGUILayoutOption:
GUILayout.FixedWidth(20). but the EditorGUI functions dont take such a parameter (only the layout version do).
if anyone cares- found this workaround: bool newArrayExpanded = EditorGUI.Foldout(foldoutRect, arrayExpanded, GUIContent.none, true); newArrayExpanded |= GUI.Button(foldoutRect, originalLabel, EditorStyles.label);
https://prnt.sc/rvk199 Any idea how to solve this ?
@silver spruce if close & repoen of unity and visual studio doesn't help.. I'd try deleteing the Library folder and let it reimport everything from scratch
@keen pumice Thanks that helped ! Do you know where i get "SampleGroupDefinition" from ? Its a error i have 81 times from the performance package due to the "Entities" depdencys
https://docs.unity3d.com/Packages/com.unity.test-framework.performance@0.1/api/Unity.PerformanceTesting.SampleGroupDefinition.html says it's in the Namespace: Unity.PerformanceTesting.. that what you mean?
@keen pumice Well i have that packet installed... but its still missing, thats the weird part :/
is the error that it is not defined? if so.. have you added that namespace as a "using" at the top of the files where you reference SampleGroupDefinition?
@keen pumice The file is simply not there... i checked the package multiple times in my editor... that file is missing :/
what file?
that structis probabaly defined in some DLL along with a bunch of other stuff. I wouldn't expect you to have a .cs file with that name.
Thats makes that problem even worse... the "Entities" package simply tells me it isnt there... "MethodMeasurement" is also missing... i upgraded/downgraded that performance testing api multiple times but the error stayed
exact error text, pls
Packages\com.unity.entities@0.8.0-preview.8\Unity.Entities.PerformanceTests\JobForEachPrefilteringPerformanceTests.cs(146,18): error CS1061: 'MethodMeasurement' does not contain a definition for 'Definition' and no accessible extension method 'Definition' accepting a first argument of type 'MethodMeasurement' could be found (are you missing a using directive or an assembly reference?)
Using performance testing api 2.0.9
I dont see a version of the Definition function that takes a "Definition" as a paremeter in the docs. I DO see one that takes a SampleGroupDefinition though. Sounds like you are just calling it improperly. https://docs.unity3d.com/Packages/com.unity.test-framework.performance@0.1/api/Unity.PerformanceTesting.Measurements.MethodMeasurement.html
@keen pumice Thanks for checking that out... but im not doing anything... this happened while installing the "entities" package... and i have no damn clue how to deal with that issue :/
ah, I see now. I'm no expert on packages, sorry bud. Is Unity.PerformanceTesting a seperate package?
@keen pumice It is required by the "Entities" package, but a seperate package on its own ^^
so, sounds like you DO have it installed.. hmm. Not sure what to suggest next, hopefully someone else wil.
@keen pumice Thanks for your helped ! Downgraded it to 1.3.3 and that did the trick... those dependencies are a real struggle :c
oh gosh, sounds like it. glad ya got it goin!
if anyone cares- found this workaround:
bool newArrayExpanded = EditorGUI.Foldout(foldoutRect, arrayExpanded, GUIContent.none, true); newArrayExpanded |= GUI.Button(foldoutRect, originalLabel, EditorStyles.label);
@keen pumice don't use a button with a label style, but just a normal label
Why make things complex...
so I can click it to expand
Also, the foldout uses 2 styles as far as I remember
the EditorGUI.Foldout() function will only let me pass a single Style in, so I'm not quite sure what you mean, can you explain, please? @onyx harness
What you did was the right way
the scene view toolbar
@lucid hedge I'm not behind a computer, I can't check that in their code for now, later I will
@keen pumice you are drawing 2 ways of interactions, foldout & button. Just use one, you don't need 2
@onyx harness that's what I want to do.. the foldout and button as seperate is a workaround this issue: https://discordapp.com/channels/489222168727519232/533353544846147585/697467435611324528
(the EditorGUI.Foldout()'s label does not respect the width of the Rect passed in.)
I know, but Foldout is already catching the click event, no?
yes.
ah.. I see.. the foldout click IS detected even when I draw a EditorGUI.Label over it. GUI.Button eliminated- thanks.
and interestingly.. the clickable area IS limited to the rect provided.
but still need to draw the label seperately with EditorGUI.Label, so it clips text that is too wide.
Yep, I told you, your trick is the right way
oh, that was for me, lol! ok, thanks @onyx harness ❤️
alright thanks mikilo but for me it's fine
I put a button in scene view and works fine for what I want to do
Does somebody know how Unity implements SerializedObject.ApplyModifiedProperties? This is an internal call to the native code of the engine, but i was wondering how they apply values from SerializedProperty... Maybe they store class member pointers in each SerializedProperty ?
Maybe
Hi, I'm just starting since few week in the Attributes/Drawer developpement, I made some usefull Attributes, but I can't use them together
examples :
this works
[ ContainComponent(typeof(TabButton))]
public GameObject tabPrefab;
this works
[IsPrefab]
public GameObject tabPrefab;
but this not
[IsPrefab, ContainComponent(typeof(TabButton))]
public GameObject tabPrefab;
the second drawer/attribute is never call.
Multiple drawers are allowed by Unity or am I doing something wrong ?
Yeah multiple ones aren't allowed :/
You can work around it with some reflection and stuff
Created a custom BuildScript. It worked a few times. Now it crashes to Desktop. Where to start?
public static void BuildGame(BuildTarget target, BuildOptions buildOptions, bool RunApp)
{
BuildPlayerOptions options = new BuildPlayerOptions();
string Path = EditorUtility.SaveFolderPanel("Choose Location for Built Game", "", "");
List<string> Levels = new List<string>();
//CollectAllFilePathsInStreamingAssets.CollectFilePath();
// Get Levels
DirectoryInfo info = new DirectoryInfo("Assets/Scenes");
FileInfo[] fileInfo = info.GetFiles();
foreach (FileInfo file in fileInfo)
{
string Name = file.Name;
if (!Name.Contains(".meta") && Name.Contains(".unity"))
{
Levels.Add("Assets/Scenes/" + Name);
}
}
// Set BuildOptions
options.options = buildOptions;
options.target = target;
options.scenes = Levels.ToArray();
options.locationPathName = Path;
BuildPipeline.BuildPlayer(options);
}
commenting out the last line does not result to a CTD-
Any errors in your editor log?
where can i find it? @waxen sandal
never used that log
`` (Filename: Assets/Scripts/Editor/PreBuild/BuildProcess.cs Line: 52)
Exception: Invalid Build Path: D:/Programming``
is the Name of the App missing? @waxen sandal
Via Window
Well not necessarily missing just incorrect
D:/Programming is the path
Try D:/Programming/build/ or something
string Path = EditorUtility.SaveFolderPanel("Choose Location for Built Game", "", "");```
Adding /name.apk does work
@waxen sandal thx
do you know how to check for Android device and run directly on it like build n run does?
No clue
damm
Are there any better information sources on SettingsProviders than the scripting reference
the scripting reference just mashes everything together and shows a variety of things and doesn't really indicate what you need and what is interchangeable
and its messy as a result of this
Does anyone happen to know if the UxmlTraits and UxmlFactory need to be a nested class within their defining types?
screams into the void
Anyone happen to know off hand if you can do inspectors with UIElements in 2018?
I'm trying to get VisualTemplates setup to function in every UIElements supporting version of unity to date
@severe python I found 3 ways to repaint the drawing container.
1/ Dirty(ChangeType.Repaint); // Which is Obsolete, prefer 2.
2/ MarkDirtyRepaint();
3/ Get the current GUIView and repaint it.
When do you call that
Still from IMGUIContainer code
In normal time, I would be able to call EditorWindow.focusedWindow.Repaint()
But in my case, I am not under an EditorWindow, but a Toolbar, which derives directly from GUIView.
making a custom package extension. Anyone know if there is something like Application.dataPath for packages?
Not that I know
What exactly are you trying to do?
nevermind looks like the start of the path is just "Packages/...."
was overthinking it
I am saving data to json and need the path of my custom package folder. I think I got it now though
Just to let you know
Path.GetFullPath gets you the path to an asset in a package
Whether it's in packagecache in your library dir or in the packages dir
Or in the Unity install dir
It's busted
They literally patched the runtime to fix that
awesome thanks I will try this out
is it possible to step through unity reference source by attaching to unity?
Rider can do it alright
but I can't speak to anything else
well, It steps through the decompiled stuff
I don't think using the reference source works
Hello, I was wondering: how do I make a custom window that holds a list in the same way as the Layer edit window? In particular: how is this kind of inspector list named in Unity?
oh so in theory the lastest VS can do it since it can decompile
but I have NFI how to turn that on
@dapper fox reordable list?
@dapper fox reordable list?
@waxen sandal mmmh, that might be it, brb
I really need a better idea of how the actual Binding system works its really confusing
I can see bind events, but I can't see how they actually are used to update fields in the Unity code base
IIRC the elements implement an interface
yeah, IBindable but its waaaaaaaaay more involved than that
there is also INotifyValueChanged which only works in simple scenarios
Isn't most things INotifyValueChanged?
I looked into a it a while ago but mostly forgot 😅
its just BaseField really
I gotta approach this whole concept differenly because I'm obviously doing something wrong
but like, how would you implement INotifyValueChanged for a field that can host any type of object and determines its content based upont he data type
(DataTemplates)
You don't because Unity does not support complex bindings
I kinda sorta really hate flexbox
I can't make proper grids
property grids literally require you to set the width somewhere in order to have alignment
its this big glaring flaw
this all looks nice
until you do something like this:
so you can either flex on the width, or on the height of the elements, but you can't do both
but my binding stuff is doing something I don't understand
the PPtr<$CampaignSegment> is the data type I found on the boundObject passed through the Binding event
I expect to find a CampaignSegment, but this is an object reference, I just want the actual target object...
it seems like Inspectors do something that I'm not seeing
my data templating and binding works perfectly under the context of inspector
but if I try to make a window, it doesn't
in the inspector, the bindings naturally establish context for nested elements
I have no idea why my custom inspector isn't showing
Does anything seem off about this?
[CustomEditor(typeof(Traveler))]
public class TravelerEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
// DrawDefaultInspector();
var traveler = (Traveler) target;
GUILayout.Label("Foo");
}
}
Everything I see seems to match every single guide/tutorial/documentation I can find and it's just not changing the Inspector in my editor at all
Show Traveler
I got it now, not sure what it was but it started working after some other messing around
Is there a way to get an animation preview to run inside a editor window?
Should ask that in #💻┃code-beginner or #📲┃ui-ux
Hello guys i have an idea to make a wizard tactical "shooter", and i want to make you can cast spell just swinging your wand in the correct shape, and i know about you can do it with line renderers but how?
oops. meant to ask this in #💻┃code-beginner - deleteing and resposting there.
Is there really no way to override the inspector Header for a custom editor? What the actual heck...
Nope
What exactly are you trying to do?
There is some part where you can infiltrate
I'm trying to add multiple components of the same type. Said type uses a unique ScriptableObject for some stuff so I wanted the header name to be the name of the ScriptableObject
I've also noticed that the object picker detects via gameobject and not via component, so trying to choose between multiple components using the picker is impossible. What is the use of multiple components of the same type then? Wouldn't it be the same if I had a list inside a MonoBehaviour and use a serialized custom class since components don't seem to offer additional functionality...
Clearly Unity does not handle multiple similar Components when picking/drag&dropping
You can still add many (as an example) AudioSource on one single GameObject
I know, I just found it really weird that they are limiting things like that. I'm literally forced to create empty GameObjects to attach my component there so I can have a different name and pick / drag & drop utility. That means that I get extra matrix multiplications for no reason. Ugh... something as simple as that shouldn't be so hard.
Well
I can suggest you NG Tools Free
There is a little utility in there to handle multi Component in an Object field
It allows you to drag & drop from Object field to Object field. And also pick a specific Component by right-clicking
Oh.. thanks a lot! I'll be checking that!
<@&502880774467354641> Who can I contact to find out more information for Unity ProBuilder in PreviewRenderUtility. I am working on an EditorWindow for a ScriptableObject and would like to be able to use the Edge selection functionality. TIA
@slender comet Please do not ping admins for support issues
This is not an official support channel
Ask on the forums
You also have complete access to the source of probuilder and can find that sort of thing if you look
My apologies. I will see about the forum. I have reviewed the code for both gits. Thank you.
Both gits? The code is local (referenced into your project) when you have imported probuilder with the Package Manager, you can just look in the Packages/Probuilder directory in your Project View (IDEs should also be able to explore it) @slender comet
Thank you
Anyone worked with the Unity Recorder yet? If so did you have pretty bad framerate?
I mean of Unity not the recording.
it is designed for offline recording, so yes
You might be able to get it to not be that bad if you were recording mp4 with some alright settings chosen
This isn't working.... It's always returning false...
Where e is the current event
It must return true when I hold leftshift and click the mouse button
Hello, I want to call a function each time I open a custom asset type (like asset.myasset), custom importer already done, I found that I can use the OnOpenAssetAttribute, but I don't know how to verify if the asset that is selected is of type myasset, can anyone help me, please
It must return true when I hold leftshift and click the mouse button
@weak bone it can't
hum... sorry, misread
Just print a log, you'll have your answer rightaway
I did... The first if condition only isn't working..
if(e.keyCode==KeyCode.LeftShift)
Debug.Log("press");
If I do
Debug.Log(e.keyCode);
It's printing None even if I press some key
I didn't understand 😅
It is possible that a left shift event is not triggering anything
If I do
e.shift
It detects..
Don't know why it isn't working for keyCodes
That's what I just said, sometime a "Modifier" (shift, alt, ctrl, fn, cmd, windows) are not being triggered
Okay, ... Even alphabets arent being detected
you must have done a mistake somewhere
Hmmm
I just did
Event e=Event.current;
Debug.Log(e.keyCode);
e.character is also not working
Oh, I had to put my cursor in the scene and press keys as I had added that function into SceneView.OnSceneGUIDelegate 😅
I wanna spawn object at mousePosition with 0 as z value
I did
SpawnedObj.position=Camera.current.ScreenToWorldPoint(new Vector3(e.mousePosition.x,e.mousePosition.y,0));
It's spawning elsewhere.. All the spawned object spawn at the same point
Anyone have experience with editor scene staging?
hey guys does anyone know why DOTween causes pause error when animating in the unity ediutor but is fine on windows and android builds?
ahh think ive got it
Anyone have experience with editor scene staging?
@next canopy?
You know when you edit a prefab it makes a "new scene" sort of thing?
Thats the prefab scene stage, its a fairly new thing, and it's not well documented, and a lot of the stuff that's useful to me is marked internal in the unity cs reference
How do I make one and open it?
How do I write my own custom scene stage for editing an asset?
By opening a Prefab, you might trigger a Prefab Stage opening (not tested)
But, what do you mean by writing your own custom stage? This is not something you customize
Why isn't it?
Description
The PreviewSceneStage class represents an editing context based on a single preview Scene.
You can create a custom type of Stage by implementing a class that inherits from the abstract PreviewSceneStage class. Your custom Stage should ensure any content it controls is moved into the preview Scene that the stage controls.```
From the manual
My search continues
As well as my journey to spread awareness about this super useful utility
Hi someone know how to use Facebook SDK: https://github.com/facebook/facebook-sdk-for-unity ?
I have Facebook ID, OpenSSL, i can run and build on my android mobile, but when i try to execute the facebook main scene, it's crashed with Unable to get provider com.facebook.FacebookContentProvider error like: https://github.com/facebook/facebook-sdk-for-unity/issues/393#issuecomment-608970257
I got this error 3 month ago, and today again
Someone have a solution ?
Hey weird question is there a good way to get the array of selected gameobjects/transforms in Edit Mode to a Monobehavior executing in Editor?
Chexk out the Selection class
.gameObjects is what you want for GameObjects
And i think you can do Object[] transforms = Selection.GetFiltered(typeof(Transform), SelectionMode.TopLevel) to get the transforms of every object you've selected
You might be able to omit the second parameter
Hello, how is something like this possible: int ("Umsatz" + Element.transform.name) = PlayerPrefs.GetInt("Element" + Element.transform.name); I try to name the integer with a string and a different number for each
This channel is for extending the editor
And no dynamically named variables are not supported
You can use a dictionary though
@chrome star just use dicts with a string as key
why would you use wizards instead of editorwindows? I dont seem to find any difference
they both seem capable of the same thing.
Wizard has just an automatic behaviour
which means editor windows are better if you want full control? @onyx harness
Indeed
Anyone knows the name of that animation window that has an avatar in it?
I am trying to add the same window in my window lol
hmm if I create an object, I can add it to a list. but if I delete that object, how do I remove it from that list?
This kind of window
@steady crest So when you say object, you mean something inheriting UnityEngine.Object which you are destroying with Object.Destroy?
Like a Game Object or something
something I am destroying by deleting the SO in my project window
its basically an itemdatabase, I want that when I add an item it add it to the list, but when its ddeleted it doesnt leave a residual file in the database
ScriptableObject has a OnDestroy event method, like MonoBehaviour
does that get called in the editor?
@onyx harness Any thoughts on my question?
yes, but doesnt ondestroy only get called on objects in the scene> I am working with assets in my database
You would like to simulate a preview window in your EditorWindow?
Nobody stated that OnDestroy is only for scene
Yes, exactly that window in the pic I sent (not sure what it is called)
public class RemoveItemIfDeleted : UnityEditor.AssetModificationProcessor
{
public static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions roa)
{
var item = AssetDatabase.LoadAssetAtPath<ItemData>(assetPath);
if (item != null)
{
var window = EditorWindow.GetWindow<EditorManager>();
window.ItemDatabase.Remove(item);
}
return AssetDeleteResult.DidNotDelete;
}
}
I did just find this
This works if you don't have control over the C# script of the SO
Prefer OnDestroy instead of polluting your pre/post process
makes sense, thx
@trim charm Preview is not an easy task
The one in the Inspector is tightly coupled to the Inspector itself
The animation one right?
The one in the picture above
So no way to do it?
If you can understand this code, yes:
You can find it in UnityEditor.PreviewWindow.OnGUI()
So just copy and paste lol 🤔
Nope
Most classes are internals
You must use Reflection
If you are not fluent with it, I can give you a little utility to generate wrappers
Yes plz
But afterall, you must understand how stuff works
Like Editor
Do you even play with Editor in your EditorWindow?
What do you mean play?
Yea
Why a list?
Based on the Editors present in the Inspector
It is one editor window
Yea I am not talking about Editor
But you need one
More like an object field inside my window that displays the object in the previewable
You can create an Editor from the Object of this field
By checking HasPreviewGUI() from the Editor, you can know if yes or no you can preview it
if yes, DrawPreview(), job done I would say
Ok but won’t that show the previewable in the object’s inspector?
So where to start lol?
E = new Editor(Object)
if (E.HasPreviewGUI() == true)
E.DrawPreview()
You don't even need internal stuff
Wonderful
lol
Bruh that won’t make this lol
i'm stupid, IPreviewable is internal...
So...
Based on your knowledge, you already know it is not going to work
How do you know?
Damn is that an insult xD?
I feel this is the opposite
I just spent some time with you to guide you toward your objective, dropped screenshot, code, advices
and at the end you tell me without even trying "that won't make this"
If you haven't tried, you can state anything
@onyx harness if I do the OnDestroy method you suggest that methods getting called every time I look at the inspector of the SO and close it. thus removing it from the database if you deselect that object
True
@steady crest Why would it be destroyed when deselecting the Object?
@trim charm You might be surprised
@steady crest When do you create it?
cuz I need to call it OnDestroy in the editorscript of the item to access the editorwindow that holds the database