#↕️┃editor-extensions

1 messages · Page 45 of 1

barren moat
#

okay, now it's lagging out horribly without having changed the code.

#

and flickering

#

😦

bright cosmos
#

I'm currently trying to make a custom property editor but every time I press play, the values keep resetting. Is there something I'm probably missing?

wispy delta
#

Can you post the code @bright cosmos

bright cosmos
#

Sorry for the late reply, I've been trying to find some solutions as well

visual stag
#

There is no reason to ApplyModifiedProperties

#

I don't think it'd break anything, but that's done for you

#

you never serialize that boolVal and that will definitely reset. Not sure if it's possible to serialize inside of a property drawer without some painful stuff, but I may be wrong on that behalf

bright cosmos
#

Yeah, I just tried the ApplyModifiedProperties in hopes of fixing the problem. I'll try serializing the boolVal and check if it works out.

visual stag
#

Any reason why you don't just set the value back to the useConstant SerializedProperty?

#

just do that, after the logic is run, instead of trying to do it across the repaint

random flume
#

any thoughts on how to make a button that spawns a field? Like I click the button, the button moves down and spawns a field

visual stag
#

In IMGUI you just... draw the fields in a loop and add to the loop from the button

random flume
#

What lol 🤔?

bright cosmos
#

I'm just starting out with editor scripting so I'm not really sure with what I'm doing hahaha

visual stag
#

Just cache the useConstant serializedProperty, and reassign back to it after the popup

bright cosmos
#

Yeah that's what I did and it worked

visual stag
#

and make the boolvalue int just local 👍

bright cosmos
#

Thanks ! 😄

grizzled minnow
#

I've seen this searchable dropdown in a few places before. Does anyone know more about a related API?

visual stag
#

Example of where you've seen it?

#

There is an API for something similar

grizzled minnow
#

The "Add component" menu is similar. But I think Odin is responsible for drawing it this way, in this case

visual stag
#

Yeah, that's odin, hence why I asked

#

but the add component menu has its own API now of 2019

#

I'll find it for you

grizzled minnow
#

Thanks! I'll take a looksie

#

Oof, I'm locked to 2018.2, so looks like I have my work cut out for me 🙃

visual stag
#

I have in the past made one manually 😛 but I can't share the code

#

fun times

waxen sandal
#

I feel like everyone has in the past 😛

#

I might've made multiple

wicked hornet
#

I'm getting this error and I don't know how to fix it

#

Rotation quaternions must be unit length.
UnityEngine.Rigidbody:set_rotation(Quaternion)
CuestickMovement:FixedUpdate() (at Assets/Scripts/CuestickMovement.cs:30)

#

Oh and it does compile, it just shows that error when I press 'q'

stark geyser
wicked hornet
#

Okay

#

Thank you!

grim monolith
tough cairn
#

oh wow this sub exists... can i showoff few screen shots of stuff that i made here ?

loud sinew
#

go ahead

waxen sandal
#

This channel is meant for code extending teh editor

hoary surge
#

Has anyone done extensive timeline customization?

#

just wondering if anyone around is available to ping for issues I run into with the things I'm attempting to do.

mystic vault
#

hey folks. any idea how to change the font used for displaying popup options? I can change the font used for the combo box when it's just inline, but not for when you click it and show the options

random flume
#

Anyone knows how to do AddComponent to my prefab in the Editor? I keep getting an error that it can’t be edited

visual stag
#

I've just pinned a resource that should help you out; it's at the bottom of the list

random flume
#

Sorry was it to me?

visual stag
#

Yup

#

The "I want to change a flag on multiple prefab assets" could be relevant. Just replace the flag modification with your add component call.
There's a lot of different ways to do modifications depending on whether you're dealing with assets, instances, etc

random flume
#

Ah yeah sweet

random flume
#

It needs a static editor flag which is probably not what I want Vertx

#

I will prolly load the prefab and do my edits

visual stag
#

Either way, that resource is where I would be looking for code examples

random flume
#

var path = AssetDatabase.GetAssetPath(myPrefab);
var root = PrefabUtility.LoadPrefabContents(path);
root.AddComponent<MyScript>();
PrefabUtility.SaveAsPrefabAsset(root,path);
PrefabUtility.UnloadPrefabContents(root);

#

Nothing 🤔

visual stag
#

):

random flume
#

Had to delete the prefab and do it again

sleek berry
#

Hey all, does anyone if there is a scripting define symbol that indicate a specific playback engine is installed?

#

I'm writing some PostProcessBuild hook that alters the XCode project using the PBXProject api. Sadly this api is only available if iOS support is installed.

#

I tried using UNITY_IOS but it seems this won't work if I compile for iOS using BuildPipeline.BuildPlayer while not starting with the Editor in iOS platform mode.

feral hinge
#

Hey, can someone help me? I'm looking for some class to inherit or a method to call where when an custom asset is created, I can modify its properties.

heavy swift
#

How do I use property drawer with UIElements inside the inspector window?

#

does any fo the previews have the inspector a UIE? or are they all Immediate mode?

visual stag
#

The docs have been updated in terms of property drawers and UI elements, though I haven't looked into implementing anything as of yet

#

Fairly certain 2019.2 would be UIElements as it's got the UI refresh in it

#

but again, you'd have to look for yourself

#

the UI Element debugger helps with that

heavy swift
#

hmmm okay, thanks

#

will download the preview and look

random flume
#

Anyone knows how those preview windows for 3D models are made?

heavy swift
#

@random flume I think it is with UnityEditor.ObjectPreview or UnityEditor.AssetPreview

prisma falcon
#

heya guys

#

If i have a class that contains a List<> made from a sub class within that class, how can i serialize the list items in an editor script?

if i serialize the List<> property itself, it just shows up by name on the inspector, but empty.

visual stag
#

Can you post some code to hatebin? @prisma falcon

#

You're likely just missing a [System.Serializable] somewhere

prisma falcon
#

doin magic over here in this scene 😛

#

mt

drifting crescent
#

@sleek berry There's a function you can use to see if a BuildTarget is installed. However, it is not publicly available so you would have to use reflection. The function is called IsPlatformSupportLoadedByBuildTarget and is located in the ModuleManager. You can check the C# reference over here: https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/Modules/ModuleManager.cs

sleek berry
#

@drifting crescent Sadly this won't resolve the issue, as at this point the code would have already failed to compile

#

The trouble is that the PBXProject references are all from the iOS platform support DLL's. So the compile of the binaries will straight up fail if the user does not have it installed

#

and I cannot restrict an assembly definition to only compile for Editor AND if iOS support is installed.

#

For now, I've rewritten the entire routine to be done through reflection

#

To give some background on the issue I tried to solve. I have a library that needs static linking for iOS. Call it thingy.a. I have an x86 and an arm build of this library, in 2 different folders, for the Simulator and device targets

#

but Unity doesn't allow me to specify on each of these "Plugins" which target they belong too

#

I use the PBXProject API to alter the xcode project during PostProcessBuild to remove the references to these folders from the global LIBRARY_SEARCH_PATHS, and add the project specific search paths back in

heavy swift
#

I'm getting some weird behaviour when setting any field in a property drawer

#

property height is EditorGUIUtility.singleLineHeight * 2.0f;

#

but its keeps kinda rubberbanding whenever I change the values on any input field

#

it draws okay when there is no change in value (2nd component), but when moving the slider or typing on the inputs this huge empty space shows up

#

anyone know what might be?

dire urchin
#

Im looking to change a value in a prefab component from a library scriptable object, and cant seem to get my changes to stick. Anyone know the process to change a component on a prefab in the OnValidate of a scriptableobject's editor?

#

I can change it, read it back, debug it, but in the end the prefab is not changed

sage summit
#

Is it normal, that Unity's Gizmo.DrawMesh function draws a lot of CPU with about 30 vertecies?

whole steppe
#

sleek berry
#

Writing a custom inspector. Is there an easy API to check if the gameObject I have selected is in the game hierarchy or a selected prefab?

#

I tried using scene.IsValid or scene.IsLoaded but sadly those also cound for the prefab edit scenes

visual stag
#

Not entirely certain, but I think EditorUtility.IsPersistent will check whether it's an asset or not

#

I imagine it'd return false if it's in the scene

#

but I could be wrong about that and would have to test it

dire urchin
#

My issue seems to have been a unity bug, sent report. It is apparently possible to fully desync prefab properties permanently editing values through editor code.

#

I made a prefab that you can drag into the scene with completely different properties than clicking into the prefab editor

#

making it impossible to ever resync

whole steppe
#

Quick question:

prop = serializedObject.FindProperty("unityEvent");
``` Finds a property(field) in my targetscript which works fine, but what about finding a propery in an external script.
gloomy chasm
#

Depends on what your use case is.

whole steppe
#

As you can see the Property is in the ListTemplate class instead the targetscript (EventListener)

gloomy chasm
#

@whole steppe can you explain what it is you are wanting to do?

whole steppe
#

I am just trying to draw the UnityEvent field thats all

#

The 2 other fields i can already draw , it works perfect

gloomy chasm
#

So if I am understanding this right. You have an EventListener class that has a list called list of ListTemplate?

#

If that is the case @whole steppe , this is how you get it if memory serves.
serializedObject.FindProperty("list").GetArrayElementAtIndex(index).FindPropertyRelative("unityEvent")

whole steppe
#

Works like a charm my friend!

#

Thanks a lot.

gloomy chasm
#

Sure thing! 😄

#

Editor scripting is really fun.

whole steppe
#

I am pretty new to it.

hoary surge
#

@sleek berry Odin can determine if something is a prefab or a scene object, so i theoretically should be possible

wild drift
#

unsure if this belongs here but I keep getting this error constantly and it makes me so upset because it interrupts my workflow

Copying assembly from 'Temp/Assembly-CSharp.dll' to 'Library/ScriptAssemblies/Assembly-CSharp.dll' failed

I have tried making my protections make an exception to my game folder and the unity folder, unsure what else I can do other than restart the program

unkempt depot
#

hey people, I want to create a node based dialogue system but have zero experience creating tools in unity. I suppose that this is a solved problem - so does anyne know of a good resources to get started with this or something similar? I mean at the end of the day I jsut need to have a graph of nodes, where each node, knows its childnode to call it on a specific action. getting a visual representation of that graph an creating a parent child relation on connection is where I am currently stuck....

waxen sandal
#

I think there are a few tutorials if you google unity node editor

pure ridge
#

@sleek berry EditorUtility.IsPersistent(uo); will return true for assets, false for anything scene-bound.

sleek berry
#

@pure ridge Does this include things in the Prefab edit scene?

pure ridge
#

Hm, good question, I haven't tested that much

#

I presume that it would return true

sleek berry
#

Sadly, it returns false it seems

onyx harness
#

It won't

#

Prefab stage has kind of instances of prefab

unkempt depot
#

@pure ridge thanks a lot 😃

unkempt depot
#

yeah I found a lot of stuff actually :D
was quite easy to create a custom node editor :))
the only problem that remains is that my custom editor has a single instance which can be opened under the window tab. is there any way to attach my custom editor to a scriptable object for example?

#

always amazed how easy unity makes most things 😄

onyx harness
#

Lol, this last sentence is full of cuteness :D

unkempt depot
#

😃

#

hey, I did c++ before - its so great to not compile for hours and be able to just go and build stuff haha

whole steppe
#

h-e-l-p

visual stag
mellow shale
#

Please tell me someone has made an editor extension that makes it easier to work with the layer matrix?? Just something like drag / drop to rearrange the layers would be great.

onyx harness
#

No one did that X)
But doing it is easy :)

willow stone
#

Hello, does anyone know a way to overwrite the built in UI Editors? like extend the inspector for the Image Component or does it really only work with sublcasses?

#

Or is it maybe possible with UI Elements?

visual stag
#

You can make an Editor with the CustomEditorAttribute of your type,
Then you can do something like this for example:

private Editor defaultEditor;
void OnEnable {
    if(defaultEditor == null)
        defaultEditor = CreateEditor(targets, Type.GetType("UnityEditor.AnimatorInspector, UnityEditor"));
}

public override void OnInspectorGUI()
{
    defaultEditor.OnInspectorGUI();
    //My extended editor stuff here
}

void OnDisable {
    MethodInfo disableMethod = defaultEditor.GetType().GetMethod("OnDisable", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
    if (disableMethod != null)
        disableMethod.Invoke(defaultEditor, null);
    DestroyImmediate(defaultEditor);
}```
#

This is all code I wrote a long time ago so take it with a grain of salt

#

Point being, you can do it all normally, but you need to do all or some of that garbage if you also want to draw the default inspector

willow stone
#

Thanks. Well I've been overwriting the normal inspectors (e.g. for Transform) with CustomEditor Attribute with no problem but trying to overwrite the Image Component for example doesnt work and subclassing "ImageEditor" doesnt work as well

willow stone
#

If nothing has changed it looks like it's not possible. This question is quite old but I tried a lot of approaches now and I guess it is not worth it:

onyx harness
#

Everything is possible. Replacing an editor was quite easy in the old system. I don't know about UI Element, but I guess it didn't change much

#

There is a dictionary that you need to alter. It is lazy initialized, after that update it and it should now use your custom editor

#

I can't show you code, I don't have my computer near me

willow stone
#

Oh that's interesting.

#

do you mean public static Editor CreateEditorWithContext ?

onyx harness
#

Not sure, I don't recall which class holds the dictionary, you need to dive into the code

#

I dropped the code in this channel a long time ago

#

Maybe if you lookup you might find it

stark panther
#

So I have this to make a rainbow color but its going kinda fast and i need it to be slower but I cant think I anything to make it do that cause my editor says everything will not work "Color.HSVToRGB(Time.deltaTime % 1f, 1f, 1f);"

cedar reef
frozen frigate
#

links are missing in the scene, but not in the prefab, and there aren't any scene overrides. if i re-add the PaletteView prefab to the scene i get the error in the second image (associated to how unity is building the treeview in the hierarchy; probably hitting that error and not finishing re-tying the links in the gui; weird that it's only happening in the scene though and not in the prefab view)

shadow violet
#

Is EditorPrefs constant across projects or just the project it was called in? So like if I had "Project 1" in 2018, and "Project 2" also in 2018, and I call EditorPrefs on my Project 1, will I be able to pull that data stored from Project 1 into Project 2? And out of curiosity (less important), is it persistent across versions? So if I had Project 1 in 2018, and Project 2 in 2019, would I be able to pull the data from the 2018 "Project 1", into the 2019 "Project 2"?

waxen sandal
#

It's per project

#

You cna look up the registry keys where it's saved

shadow violet
#

Ah ok, thanks

onyx harness
#

@shadow violet if I recall correctly, it is per company/project name.

#

(need to confirm)

ashen star
#

How can I solve the "cannot build Gradle" when I am trying to build all?

#

Apk*

#

Build app*

gusty valve
#

Hello. I want to make a box that has a label in it and a toggle. The toggle should be aligned to the left corner of a box, while the label should be at its center. The box is intended to be stretched horizontally. How do I do this?

whole steppe
#

What to do?

#

Do i need replace the script with something

random flume
#

How did you ping me @whole steppe ??

whole steppe
#

accidentily mate

random flume
#

You didn’t even edit your message

whole steppe
#

???

random flume
#

How did you @ me?

#

And did you ping Dibbie by mistake too??

whole steppe
#

Its possible i pinged multiple people

shadow violet
#

O.o (also hi Nova)

#

What version of unity are you trying to run this on anyway?

whole steppe
#

2019.1.11f

#

But i alreaday fixed that thank you

#

Assets\RealisticCarControllerV3\Scripts\RCC_GetBounds.cs(3,7): error CS0246: The type or namespace name 'ParticleSystemRenderer' could not be found (are you missing a using directive or an assembly reference?)

blissful burrow
#

You shouldn't need that using up there

#

With the ParticleSystemRenderer

#

Oh, uh ping @whole steppe

#

I've got a question for people who are AssetDatabase savvy!

A: Why is it not possible to add sub assets to shaders?

Or B: Why can't shaders be sub assets of a custom ScriptableObject asset?

#

They both lead to different issues. In the case of A, an error is thrown about serialization version not matching (likely not the actual issue), and the sub asset isn't added

#

In the case of B, the shader is added as a sub asset, but, it loses all its code and it's basically not a shader anymore, just an empty vessel

waxen sandal
#

Sounds like a question for Richard Fine 😛

blissful burrow
#

Basically I'm trying to find a way to combine a shader and my own data / objects into a single asset object

waxen sandal
#

Does it have to be its own singular file?

blissful burrow
#

Preferably, yeah, I don't want to juggle multiple assets

#

Which makes me wonder - how does Shader Graph do it?

waxen sandal
#

Just hide your shaders somewhere and get a reference to it

blissful burrow
#

No, I want them to be visible in all the ways people expect, for things like drag and drop references etc.

#

Presumably Shader Graph has node metadata and the actual shader in a single file, right?

waxen sandal
#

I haven't actually used Shader Graph yet

#

So I'm not sure

blissful burrow
#

Haha, me neither

waxen sandal
#

I'm curious though so I'm booting up my decompiler 😛

blissful burrow
#

I guess I should have~

waxen sandal
#

I'm a little surprised you haven't

blissful burrow
#

I guess I should be too

#

I think I've never had a use for it, as I've just either maintained my local version of Shader Forge, or just hand-written shaders

#

Seems like Shader Graph has some experimental render pipeline requirement?

#

Rather than, just working with the standard render pipe

#

I could be wrong, haven't really looked into it proper

waxen sandal
#

I asked Richard Fine on Slack, I'm sure he knows something about that

blissful burrow
#

Ah, thanks!

waxen sandal
#

Hmm

#

He doesn't know offhand, but apparently they're kind of in a weird place because they're more like script assets and less like "normal" assets

blissful burrow
#

Yeah, they're not yaml serialized and all that

#

I guess I have to do the thing I did for Shader Forge

#

Serialize all the metadata in the .shader file itself as text

#

But yeah, thing I wish I could do:
Make all materials using a specific shader automatically be a sub-asset of that shader

#

So all your materials are nested under the corresponding shader

#

But alas

waxen sandal
#

I'm looking into how shaderforge does it

#

You've got me curious 😄

blissful burrow
#

I just jammed all the data into the .shader file as a comment

waxen sandal
#

Yeah I recall that's how it worked in ShaderForge

blissful burrow
#

Although for some reason I was using my own hierarchical .csv-like serialization which I definitely shouldn't have

#

I should've just used json

#

Looks like ShaderGraph has its own asset format, and the .shader file itself is nowhere to be seen. I'm guessing it generates the .shader into the library folder or something

waxen sandal
#

Yeah

#

But if you look at the assetimporter

#

It looks like it ads the shader to the main context as main object

#
            ctx.SetMainObject(shader);```
#

@blissful burrow Random question in between, are you still streaming often?

#

I've forgotten to pop in for ages

blissful burrow
#

I do!

#

About two/three times a week

#

Starting tomorrow this week

waxen sandal
#

Tomorrow is the one day I'm busy 😛

onyx harness
#

As Navi stated, Shader assets have a 'real life' content (like other types of assets such as text, script, image), which is code.
Prefab in the other hand (or ScriptableObject, scene or any Unity-related assets) are understandable by the serializer, and be converted to yaml.
Adding the latter as sub-asset makes sense.
Adding a C# file under prefab or SO is physically not doable (for the example).

So, I'm curious how you saw that in shader Graph

blissful burrow
#

Saw what in Shader Graph?

waxen sandal
#

I'm looking at the code from the scriptedimporter for the shadergraph asset

waxen sandal
#

And it's literally loading the same asset as a shader somehow

onyx harness
#

'Which makes me wonder - how does Shader Graph do it?'

blissful burrow
#

Ah! I meant "do it" as in, "solve this problem", not as in "nest .shader assets"

waxen sandal
#

I feel like ShaderGraph is just a normal asset that is deserialized as json then the nodes get parsed and converted to raw shader

#

Which is then handed as normal by the AssetDatabase

blissful burrow
#

I suppose, yeah, and that is then imported into the Library or some other cached folder?

#

It seems super hacky, but, makes sense I guess?

waxen sandal
#

I think it might just be an in memory thing

blissful burrow
#

Well, I doubt it would have to recompile all Shader Graph shaders as you open your Unity project

#

That can't be the way they designed it

waxen sandal
#

Right, you're correct

#

I missed a part

blissful burrow
#

It's interesting, I'm curious to play around with this myself now

waxen sandal
#

It starts by loading the old shader

blissful burrow
#

What is the "old shader" in this case?

waxen sandal
#

Which is then not really used

onyx harness
#

Library is for existing assets.
If their trick is a post-deserialization convertion, Navi is right, it will be memory only

waxen sandal
#

If you look at ShaderGraphImporter:59

#

They're imported the same asset through the assetdatabase, the assetdatabase probably cached it in the backend of things

blissful burrow
#

@onyx harness Not sure what you mean

#

Library is for existing assets, sure, and a shader you already compiled would likely be placed in there, as an existing asset, and loaded on demand when needed

#

Which is what I presume it does

#

I really don't think Unity reconstructs all shader graph shaders on load just because it has to lie in memory and can't be cached

waxen sandal
#

What I think is happening is that the import asset triggers the custom importer, which then parses the shadergraph file manually and generates the Shader asset.
The generated shader then gets set as the main asset of the AssetImportContext. This in turn causes it to be seen as a normal asset and cached somewhere in the Library folder for persistance.

onyx harness
#

Hum... I'm sorry I don't have a pc to look into Shader Graph, I would have gladly dive into this question

blissful burrow
#

@waxen sandal Yeah

waxen sandal
#

I think it has to do with how ScriptedImporters work

#

Which should totally be doable for your own thing

blissful burrow
#

Exactly

#

Which is neat

#

I should experiment with this~

waxen sandal
#

Wish I would have time to do that as well 😄

blissful burrow
#

Same

#

Haha

waxen sandal
#

I was going to say that neat is an understatement but you know neat corporation 😄

blissful burrow
#

waxen sandal
#

Anyways, will you be streaming on Friday as well?

random flume
#

Like the new pic @shadow violet xD

waxen sandal
#

If so, I'll try to remember to pop in and say hi

shadow violet
#

Thanks fam o.o @random flume

random flume
#

Shit no karmas here 😦

#

Thank me in GDL

shadow violet
#

Lol, rip :p but actually I might have an asset in a few days I'll need testing o.o

random flume
#

Oh very nice!

#

You can pm me if you want me to test it

blissful burrow
#

I'll probably be streaming Friday too @waxen sandal ! Feel free to join

shadow violet
#

Alright, sure

waxen sandal
#

@blissful burrow Lets hope I don't forget this time 😄

blissful burrow
shadow violet
#

Haha, that's actually so accurate :p - when do you stream? Like what time (and timezone)? @blissful burrow

waxen sandal
#

Haha, happens to the best of us 😃

blissful burrow
#

Uh, it varies a lot unfortunately, and I live like 50/50 in Seattle and Sweden. Currently in Seattle. But, around this time Tomorrow and Friday I would guess?

waxen sandal
#

I didn't know you lived in Seattle 😮

blissful burrow
#

Technically/legally I still live in Sweden, but have very long visits to Seattle

shadow violet
#

Ah ok, understandable, I'm close to finished work around this time so hopefully I can catch it

blissful burrow
#

Feel free to join! I stream dev on my own game, while also answering any questions you might have, explaining what I do as I go along! I try to make it a tutorial-like thing, especially when people are asking stuff

shadow violet
#

That's good! Those type of streamers tend to be the most engaging imo, excited to see your progress and such

blissful burrow
#

Anyhow, sorry for going a bit off-topic, I don't want to displace people who have actual editor scripting questions acegikHeart

waxen sandal
#

It's changed a little since I last checked in

#

Should play the beta some 😄

tough cairn
#

Is it possible to use IMGUI outside the OnGUI function ? I want to draw UI with Code in 3D space ? Perhaps draw it on a plane ?

visual stag
#

@blissful burrow I don't know if this was properly answered, but I believe you can only add sub-assets to assets that are imported directly into the Library by Unity. .shader files, like image files, are imported as conversions of their original source. The Importers re-write the entire file to the library when they run.
To add sub-assets you would have to write your own importer, and it would operate on the .shader source file to generate those assets.
To add a sub-asset is to literally write the data into the asset file itself, so that when it's imported it contains that data.
To do that to something that is an external source file doesn't really make much sense.

blissful burrow
#

Gotcha, thanks!

shadow violet
#

Is there any way to use a # to check the scripting runtime version of a project? Like there is PlayerSettings.scriptingRuntimeVersion but am I able to basically say something like

#IF  PlayerSettings.scriptingRuntimeVersion == ScriptingRuntimeVersion.Latest
//do 4.6 language-specific code
#ENDIF

? I have some code in one of my editors that use the dynamic keyword as a solution to a work-around problem, but projects using 3.5 scripting runtime, will get an error, whereas projects running 4.6 is perfectly fine (since "dynamic" keyword is I think language 4+) so I wanna make sure the code is ignored if thats the case and just display some sort of "sorry we cant give you this feature in the current version of your project" or something

shadow violet
#

Awesome, thanks!

hushed sentinel
#

Hey, does anyone have experience with the AssetPostprocessor?
I have this script in the Editor folder, but it doesnt trigger any of the ProcessModel methods, when i import a new fbx file or reimport an existing one. Also tried restarting unity/ other unity version (im using 2019.1.7f1)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class FBXImport : AssetPostprocessor
{
    void OnPreProcessModel()
    {
        Debug.Log(assetPath);
    }

    void OnPostProcessModel(GameObject g)
    {
        //Only process fbx files
        if (assetPath.Contains(".fxb"))
        {
            Debug.Log("Processed "+assetPath);
        }
        else
        {
            Debug.Log("Imported non fbx file");
        }
    }
}
grizzled minnow
#

@hushed sentinel You're checking for .fxb instead of .fbx 🤓

hushed sentinel
#

xD oh... yeah thats a mistake... still it should trigger the other debug.log, right?

#

@grizzled minnow

torn zephyr
#

I'm trying to understand how to add extra columns to ReorderableList, I never knew it was an option until the RPG Creator's kit. Here's a screenshot of the component: http://prntscr.com/ok73jh By multiple columns, I mean the "A.0, Hello Traveller..." being two different entries. Here's a pastebin of ScriptableConversationEditor.cs : https://pastebin.com/WKAPFJaw , which should be the relevant file here I think. My Google Fu is failing me on this one, is it a new feature? I THINK the relevant section

#

*I THINK the relevant section is OnDrawElement(), but I'm not sure about what's even going on well enough to be sure. Can someone explain how it's doing it or point me in the right direction?

uncut snow
#

Hi is there a way to serialize a list of abstract classes ?

waxen sandal
#

Like a list of their types?

#

What exactly are you trying to serialize

#

Instances of derived classes?

craggy kite
waxen sandal
#

Is there a way to find all monoscripts in a project including the ones in packages?

#

Oh nevermind, I already got it

#

This project just has surprisingly little scripts

visual stag
#

AssetDatabase.FindAssets("t:MonoScript, new[] {"Assets", "Packages"}); via code

waxen sandal
#

AssetDatabase.FindAssets("t:monoscript") works as well

visual stag
#

That wouldn't get in packages by default I think? Not certain if that's changed

waxen sandal
#

Apparently it does

visual stag
#

Must have changed then

waxen sandal
#

Or I might be doing something else wrong

waxen sandal
#

@visual stag It definitely does work without specifying Assets and Packages

umbral creek
#

i need help im trying to install lightweight rp

#

but im afraid something would go wrong and my assets would dissapear

misty quail
#

are you using git ?

umbral creek
#

well i was trying

#

i followed the tutorial

#

but it didnt work

#

its not that it didnt work'

#

its that when i followed it the files wasnt there

misty quail
#

what you can do is : push your project on the cloud, then install what you want and if it messes the things up you can just revert the changes and get back the original project

umbral creek
#

and since im using the collaboration thingy it said version control something something

misty quail
#

oh ok

#

if you use unity collab i dunno

umbral creek
#

okay

#

anyone else wann ahelp

visual stag
#

This channel is for extending the editor, not for general questions. #💻┃unity-talk is a better place to ask about source control with unity.

umbral creek
#

o

inland vale
#

so I wanted to have this message occur only in edit mode when destroying the component. I can check for Application.IsPlaying and EditorApplication.IsPlayingOrWillChangeState
but unfortunately the message still appears when quitting unity with this inspector open
or when unloading the scene
what are you thoughts about handling this? I don't want to just not tell the user about the extra components, i doubt they'll notice an error message in the console, and working around the ondestroy issue or on application quit issue both involve creating a separate class that listens for these events and doesn't seem worth it if i'm going to do this more than once

#

i can subscribe to the editorapplication.quitting event but i wanna avoid having a a whole bunch of editor scripts subscribing and unsubscribing all the time and making listening functions for them

#

I also can't seem to find any way to know if the OnDestroy() is being called by the scene being unloaded or reloaded

cedar reef
#

Not really a known solution for detecting if the editor's changing scenes, though

shadow violet
#

For a editor script, is saving JSON/text files to be read in by the asset, to the "My Documents" folder the best thing to do? I was thinking of putting it in the actual Unity installation folder, but I want it to work across multiple Unity versions so that wouldnt wok, and I donno if its weird for an asset to go into a users Documents folder o.o basically these are "templates" that come with a few default ones, but the user can also create and modify their own templates, that are automatically added to a folder, and then choose which template is used by the asset, in any project they want, and the asset will work based off that template

shrewd hatch
#

@shadow violet what about reaching the user"s projects folder and creating a folder named templates there?

It could work as long as the user didn't have multiple different folders for unity projects and no project name template

shadow violet
#

@shrewd hatch if im understanding you correctly, that would assume the user has 1 common folder they put ALL their projects in? What if they dont? I do some freelance work for this one guy who for whatever reason, has like 12 projects on his desktop, and a bunch of a external drive, and just a few in the Documents folder, but hes not really a developer, per-say, he may be a special case o.o

shrewd hatch
#

Yes I'm assuming that
And the funny thing is that I do have more than 1 folder with projects but I assumed I was a special case as well 😅

shadow violet
#

Lol :p fair enough - that does give me an idea tho... What I could do is default to "My Documents" and allow them to enter a specific path where they want my templates to exist, and then move the contents already saved from My Documents to that specific path, and then save in My Documents a text file that contains the specific path they always wanna access templates from, that way across projects when they start it up, I just pull the path from that, unless I can somehow save that path in like a registry and pull from that across projects, but EditorPrefs I was told, is per-prooject

shrewd hatch
#

Also, what about that folder under the user folder, AppData I think? I believe it's purpose is to store this type of stuff

But yeah I like that solution

zealous coral
#

Made a grid editor that allows me to "edit coordinates" in different list based on height, along with control hotkeys. Using this to edit both walkable path and collision layer.

whole steppe
#

Quick question. Is there any place with up to date Unity tutorials that aren't videos and focus on scripting?

#

I'm going nuts trying to learn how to create procedural UI in Unity, because I work 10 to 12 hours per day. I really can't spend an hour listening to someone stumble through nibbles of information. I'd reach what I need per hour on a per month basis.

#

IMGUI does what I need, but looks terrible. And drawing to a Canvas object is so poorly documented that it makes me want to chew my own face off trying to do it.

visual stag
#

@whole steppe This channel is for extending the editor, not for general questions. #💻┃unity-talk is a better place to ask about tutorials.

shadow violet
#

@shrewd hatch I think that AppData folder is still project specific tho, cause when you navigate to it, its something like C/Users/[Computer]/AppData/LocalLow/Company/Project/file.json, tho I guess I can just navigate backward and cut off the "/Company/Project" part, so it saves directly to LocalLow... That could actually be a viable option too now that I think about it, im gonna give that a try - thanks for the idea on it :)

shrewd hatch
#

You welcome and that's what I was considering, maybe even making a folder with your asset's name in LocalLow

shadow violet
#

Yeah, im gonna try "Roaming" since on Windowss, thats across all profiles/accounts, and then test with people on Mac and Linux, since they dont have a "AppData" folder at all, ill have to tweak it for those platforms

zealous coral
grizzled minnow
#

Does by any change anyone know if the checkered background used for transparent images is accessible anywhere? Would like to use it in a UI

zealous ice
#

Hey, I'm trying to figure out UIElements, any idea how to detect button click?

#

MouseDownButton doesn't work

shadow violet
#

@zealous coral yeah, thats what im using now, but the problem is, that AppData is Windows-specific, Macs dont have a AppData folder, and it points to somewhere else different, so I cant use my logic of removing "company name / product name" to get to the root AppData folder - and basically what I have right now, I know will only work on Windows, so im not sure what will happen on Mac/Linux, but my guess is itll just throw a error saying the path doesnt exist:

static string templatesPath = Application.persistentDataPath.Substring(0, Application.persistentDataPath.IndexOf("AppData") + 7) + "/Roaming/Unity/Project Templates"; //%AppData%/Roaming is a consistent path across PC profiles
zealous coral
#

Application.persistentDataPath is platform dependent, it changes automatically, u dont have to force it use "AppData" at all

#

unless u are trying to make some weird sharing/reading behaviour that somehow would read different platforms sometimes

zealous coral
#

@zealous ice from my previous testing, i found one way

Button button = new Button(()=>{printf("button clicked");});

there is also button.RegisterCallback, but i didnt look too far into it

zealous ice
#

I done it using register callback, trick is to find correct event

#

MouseCapturedEvent in this case

#

also, new Button doesn't work with uxml

zealous coral
#

what do u mean doesnt work ? i am still extremely new with UIElements too so i am just trying to help as much as i can

shadow violet
#

@zealous coral yeah thats what I planned to do using preprocessors, but the problem is, I want it in the root directory of where that platform saves persistent data path files to, and I only know how it works on Windows cause I own a Windows PC, so my logic with that bit of code wouldnt work on the other platforms, so id have to use preprocessors most likely anyway - what im trying to do is basically save text files to a location that will be common/persistent across any Unity project and Unity version, the full path for persistantDataPath, is project specific, and since I know exactly how the path works on Windows, I can go to the root of that and save there for Windows computers, I donno if that makes it more clear or more confusing o.o

static nexus
#

How can I go about getting the name of a scriptableobject for a custom editor? I am wanting to save myself a little time by setting a string to that name for items in my game.

full flax
#

hi 😃

#

when I have something like a public gameobject on a class, it will show up with a file navigation and a little circle in the inspector

#

what function is that in a custom editor window?

waxen sandal
#

An objectfield?

#

@static nexus If you have a serialized object then you can just so.FindProperty("m_name")

static nexus
#

Yep, that worked.

#

Is there like a reputation bot or anything on this server?

full flax
#

thanks navi

waxen sandal
#

Not that I know of @static nexus

static nexus
#

Ah, well thanks.

full flax
#

thanks vertx 😃

#

so I can get one object with objectfield, how do I populate a list with objectfield

shadow violet
#

Like... Do you mean selecting an object with object field and then adding to a list after that 1 object selection? Or like selecting multiple object fields at once or something and adding each to a list?

full flax
#

more of the first I think

odd swan
#

anyone trying new UIElements?

#

I have some trouble with binding

#

without UnityEngine.Object

#

or there's way to tracking undo/redo in UIElements has no bind?

odd swan
#

um nevermind :/

shadow violet
#

@full flax you could do like:

static List<string> whatever = new List<string>();
static Object obj;
void OnGUI()
{
obj = //your ObjectSelector line;
if(obj != null)
{
foreach(string s in (desiredType)obj.propertyWhereListIsContained) {whatever.Add(s);}
}
}

If I understand you correctly - though I guess youd wanna store "desiredType" as the actual type, if you know exactly what your accessing, otherwise it would be generic and you probably wont be able to get the exact variable from the object your looking for, without casting it first

timid cobalt
#

How do I display unityevents in the editor window, I have looked and cant find a good answer.

waxen sandal
#

I think propertyfield can draw them

timid cobalt
#

Do you know how

#

@waxen sandal

waxen sandal
#

EditorGUI.PropertyField?

timid cobalt
#

It says it cant convert unity event to serialized property

cedar reef
#

Do you mean in the inspector, when you have an object selected?

#

Or in a custom editor?

timid cobalt
#

Custom editor window

cedar reef
#
            var serializedObject = new SerializedObject(objectWithEvent);
            var property = serializedObject.FindProperty("eventName");
            EditorGUI.PropertyField(Position, property);
#

@timid cobalt

timid cobalt
#

I am still confused

#

Sorry

#

This is all on the editor window script?

cedar reef
#

Yup

#

You need to replace objectWithEvent with your object reference, and eventName with the name of the UnityEvent field

timid cobalt
#

The add to list button now dosnt work

full flax
#

dibbie: thanks 😃

edgy lake
#

hi!

#

i'm trying to make this current object just follow my cursor

#

but it's not showing on my cursor :(

visual stag
edgy lake
#

@visual stag ah thank u

#

:)

sage summit
#

Yep you got it backwards.

shadow violet
#

Anyone know if there's an easier way than the TreeView "tutorial" on making a foldout-toggle? Iv tried basically recreating it with just those 2 parts I need and I can't seem to get the repositioning correct when expanding collapsing (I'm on mobile atm so I can't get to my code, but if needed later today I can show the code iv tried), or if there may be a better way to display a hierarchy of folders and files the user can decide to toggle if they wanna include or exclude?

waxen sandal
#

TreeView is the best option imo

shadow violet
#

I tried working with it but it has so much extra crap I don't want or need and can't seem to hide the stuff I don't want, like I don't wanna show the top columns bar at all, just the content, and I tried rolling my own solution, after work, I can post my code that uses toggle and foldout, and hopefully it'll be understandable, cause it's a bit... Weird imo

waxen sandal
#

You don't need the top bar?

#

Look at Example 1

shadow violet
#

Hmm, is there a way to turn example 1 into a toggle foldout, similar to the "import asset" window? Cause I couldn't find where it was actually drawn to extend it, later im gonna try to add some buttons to certain ones and such and it seems so deeply rooted, that it's kinds "this is what you get", but I was looking at the transform view at the time

waxen sandal
#

I think you can provide a template for the items

shadow violet
#

I'll take another look then when I get home from work, and if I can't figure out how to modify the template being used, I'll show you the code I had - do you know if there's anywhere online that talk about the templates?

waxen sandal
#

If you scroll down on the same page to Customizing the GUI

shadow violet
#

Alright, I'll take another look then, and be back if I have issues, thanks for the guidance/direction

idle anvil
#

here what i got: Assets\Resources\Scripts\CharactersScripts\Editor\SkinsChangerEditor.cs(31,35): error CS0115: 'SkinsChangerEditor.CreateInspectorGUI()': no suitable method found to override

idle anvil
#

decided to trash that code, it's not working like i wanted pfff

whole steppe
#

Can you create a script that will automatically edit a polygon collider to match the outline of the shape displayed in the sprite renderer?

visual stag
#

Isn't that a thing it automatically does

#

If you tick Generate Physics Shape on the Sprite Importer

whole steppe
#

It's not accurate from my testing

cedar reef
#

You can make such a script, but it wouldn't really be trivial

#

Assuming it goes by color or the alpha of the pixels on the texture

whole steppe
#

I'm very new to unity, do people just usually use the manual edit collider feature? It seems very impractical and I can't find any way to snap to the edges of the sprite etc

cedar reef
#

It depends on how accurate you really have to be...polygon colliders are a lot more resource-intensive for collision detection than simple colliders

#

I usually stick to simple colliders if I can help it

#

Even two or three colliders is still better than one polygon collider, to my understanding

whole steppe
#

My shapes are very simple, such as T shape object. It won't take too long to do manually but it's difficult to get straight edges because I can't find a snapping feature

cedar reef
#

If it's a simple shape, use two rectangle colliders instead

#

Two box colliders, that is

whole steppe
#

Wouldn't that mean I would have to use 4 colliders? I use the colliders with 'Is Trigger' selected and I have found that the the objects just fall through each other if you don't have any box colliders attached to your object without 'Is Trigger' enabled. Not sure if that makes sense

cedar reef
#

Why do you need both triggers and regular colliders?

#

If that's something you need to do, yes, you'd need 4 colliders, and it is something that's needed sometimes

whole steppe
#

because if i have a object with a single collider with 'Is Trigger' enabled, it will just fall through objects regardless.

cedar reef
#

There's a special component that will blend your simple colliders together, too

visual stag
whole steppe
#

Sorry vertx, one last question because it's relevant to the previous message. Dameon, do you know what component that is?

cedar reef
#

Composite collider

whole steppe
#

Thanks

whole steppe
#

Hi everyone! Super excited to be here! Just finished the complete Unity udemy course!

mellow shale
#

Possible or existing simple fix to darken or replace the checkerboard backgrounf, so it's easier to seee filesize info:

#

alternatively, change font color of that info.

idle anvil
#

is there a way to use this csharp EditorGUI.DrawPreviewTexture(new Rect(25, 60, 100, 100), sprite);

#

with UIElements?

visual stag
#

Use an IMGUIContainer

idle anvil
#

i though so

grim walrus
#

Can you extend the elusive hierarchy search?

idle anvil
#

it's really taking place with these many ^^;

#

so, i was thinking with image, it could help me greatly

visual stag
#

@grim walrus not sure, but you may have more luck making a provider for the QuickSearch package

idle anvil
#

so far, here what i managed to do: ```csharp
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEditor.UIElements;

public class SkinsChangerEditor : Editor
{
//[MenuItem("Window/UIElements/SkinsChangerEditor")]
[CustomEditor(typeof(SkinsChanger))]

Texture2D sprite;
private SkinsChanger _skinschanger;
private VisualElement _RootElement;
private VisualTreeAsset _VisualTree;

private List<Editor> objectPreviewEditors;


public override VisualElement CreateInspectorGUI()
{
    var vis = new VisualElement();
    return vis;
}

public void OnEnable()
{
    _skinschanger = (SkinsChanger)target;

    _RootElement = new VisualElement();
    _VisualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/Resources/Scripts/CharactersScripts/Editor/SkinsChangerTemplate.uxml");

    //Load the style
    StyleSheet stylesheet = AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Resources/Scripts/CharactersScripts/Editor/SkinsChangerStyles.uss");
    _RootElement.styleSheets.Add(stylesheet);
}


public void AddButtonIcon()
{
    IMGUIContainer icon = new IMGUIContainer(() =>
    {
        EditorGUI.DrawPreviewTexture(new Rect(25, 60, 100, 100), sprite);
    });
}

}```

visual stag
#

well ya gotta make some queries and add that container to an element. I've only done direct stuff though, so can't really help around UXML

idle anvil
#

for that part, i managed to do this: ```xml
<VisualElement class ="row">
<Label text="List of Momoo looks" class="header"/>
</VisualElement>
<VisualElement class ="row">
<Button name="momoo_Flat_C" class="overrideController-button">
<VisualElement name="Icon" class="overrideController-button__icon" />
<Label text="Momoo Big Udder Clothed" class="overrideController-button__label"/>
</Button>

</VisualElement>
</UXML>```

#

and the CSS: ```css
.row
{
display:flex;
flex-direction: row;
justify-content: center;
}

.header
{
font-size: 15px;
color: #ffd800;
}

.overrideController-button
{
height: 125px;
width: 125px;
margin: 5px;
justify-content:flex-end;
}

.overrideController-button__icon
{
pointer-events:none;
}

Label
{
font-size:12px;
}```

#

i'm very familiar with css and xml but not much with c# 😬

cinder axle
#

Took me a while to find this one... var pinfo = UnityEditor.PackageManager.PackageInfo.FindForAssetPath("Packages/package.name/asset");

waxen sandal
#

Why does it have to be so hidden

nimble stag
#

Hi all, is any chance in UnityEditor draw line between 2 objects?

wicked elm
nimble stag
#

Is possible use in unityeditor this?

visual stag
#

Can you not use Debug.DrawLine or Gizmos.DrawLine?

nimble stag
#

@visual stag I will try when I alive at home

waxen sandal
#

Is there an event that gets called when a script is created?

#

AssetModificationProcessor.OnWillCreateAsset doesn't get called for scripts

real ivy
#

Hi guys. Anyone using VS Code?
In Unity 2019 you can double click in console the stack trace, but it doesn't seem to work for VS Code. I remember it worked when i's still using VS

nimble stag
real ivy
#

I did that. VS Code works when i double click console debug or the monobehavior. It's just the new 2019 feature where the stack trace is colored blue and u can click on those to get to each stack trace

nimble stag
#

Then I dont know 😦

real ivy
#

Hmm thx anyways

#

I only started using VS Code like a few months. While i like it, i think i'm going back to VS because it's more hassle free and more "built in"..

nimble stag
#

I still using VS2013 😄

young falcon
#

I would like to have a settings class (in editor) that manages persistent data. I would like to:

  1. serialize/deserialize this data,
  2. benefit from Unity's undo/redo system,
  3. display it as one of the "Project Settings", and
  4. read these values from "InitializeOnLoad*" functions/methods.
#

All of the examples related to SettingsProvider show ScriptableObjects, but ScriptableObjects don't allow for #4.

#

Does anyone know how the internal "Project Settings" are handled?

tough cairn
#

Any ideas when the new editor theme is going to be included in the installers ?

whole steppe
#

I tried to switch from vs 17 to 19 but 19 didn't have intelisense for whatever reason so i switched to vs code which i am glad i did since it looks much better

whole steppe
#

Also is switching to jetbrains rider worth it?

regal jasper
#

@tough cairn it will be on 2019.3

#

@young falcon actually you can read from there, just use EditorJsonUtility to read the values from there

#

@whole steppe I switched Rider has been one year and I don't regret, it has a ton of cool features that now I missed when I tried VS 19, but I do recommend to install it on a SSD to speed up when starting it

whole steppe
#

@regal jasper do you have the student license ?

idle anvil
#

does rider didn't do like vs 19 by installing 32gb of stuff?

whole steppe
#

what do you mean

idle anvil
#

augh my english...

whole steppe
#

it takes 30 gb?

idle anvil
#

vs19 yes

regal jasper
#

@whole steppe I've used the studant license by 6 month, then I upgraded to the personal one (it has a cool discount if you do that :p )

idle anvil
#

i was fooled once during 2016

#

or 2017? can't remember

regal jasper
#

@idle anvil no, Rider is like 5 or 10gb at worst if I am not mistaken

whole steppe
#

vs code is better than vs studios

#

so much better looking faster and lighter

idle anvil
#

oof, that is alot too but much less than from microsoft apparently

#

and yes that is what i'm using vs code

whole steppe
#

good,

idle anvil
#

after i dished it but unfortunately, i had no idea where the rest of stuff came from...

#

which i was forced to buy a new SSD

#

it was 128gb

#

now i'm using 512gb

waxen sandal
#

My Rider folder is only 3.23 gigs

whole steppe
#

@idle anvil is that your only disk?

idle anvil
#

nope, i do have 4 HDDs

whole steppe
#

why do you need so much space

#

hormones?

idle anvil
#

SSD is mainly for Operating System

#

would you please stop joking...

#

like i was going to said, i also use SSD for my 3D softwares well some art software for them already

#

the rest of HDDs are mostly my art datas as well my games and musics

whole steppe
#

top kek

idle anvil
#

also, i can't afford to get these 2TB for SSD back then, i'm not THAT rich you know?

raven pebble
#

Hello fellow devs!

I have a problem with Handles...
Like in the image pictured, ProBuilder draws it's vertex handles/wireframe hints - cool.
I have a script that analyzes PB vertices and draws a circle around some of the vertices.
Apparently, the circle is getting drawn behind the PB vertex handles and PB wireframe.

Is there a way to draw handles with specific depth, as to draw my circle on top of PB stuff?

queen crag
#

Does anyone know of a way to force a Repaint in a window derived from PopupWindowContent?

visual stag
#

I'd imagine you just repaint the attached editor window

queen crag
#

well it's being created by a property drawer

#

oh you right, PopupWindowContent gets a reference to the window it's in

velvet eagle
#

👍

blissful burrow
#

Editor serialization is uh

#

quite the thing

#

this is fine acegikKashade

#

Trying to figure out a nicer way to do it compared to my old method of making almost everything UnityEngine.Objects, but I fail to think of any

#

Big complex plugins really need object references to be serialized, heckity

cedar reef
#

Unity doesn't do polymorphic serialization, which definitely sucks

#

No Interfaces, no generics, no polymorphic arrays

blissful burrow
#

It does serialize with polymorphism if you derive from UnityEngine.Object though

cedar reef
#

I really wish they'd fix their serialization...it's so annoyingly limited

blissful burrow
#

Yeah it's pretty crazy

#

It hasn't changed from what I can tell ever since Shader Forge, and that was like, a scary amount of years ago

cedar reef
#

I don't think it'll serialize polymorphic arrays is the problem. A List<UnityEngine.Object> will just get cleared out when the editor reloads, from what I remember

blissful burrow
#

Pretty sure that one is fine

cedar reef
#

Yeah, I wish I could just circumvent it and use SharpSerializer or whatever

blissful burrow
#

Hehe, yeah

#

I thought of doing that

#

But then undo might be an issue?

#

Since it relies on the serialized data and all

#

Or rather - relies on it having to be Unity-serializeable

cedar reef
#

To make the editor use entirely different serialization would be a pretty extensive overhaul, no idea about undo

#

Undo works fine on just regular objects marked Serializable

blissful burrow
#

Not really but I see what you mean I think

#

: >

cedar reef
#

One approach I've played with is to keep your classes 90% plain C# classes, and have very limited interaction with the editor, and use custom serialization

blissful burrow
#

Undo.RegisterObject only works with UnityEngine.Object, but I'm guessing you're talking about non-UnityEngine.Object derived serializeable fields in them

cedar reef
#

Yeah

blissful burrow
#

Ah, neat, did it work out?

cedar reef
#

It's got its upsides, but winds up working around the editor a lot, which kind of defeats the purpose of having the editor

blissful burrow
#

Hm, alright

cedar reef
#

But opens up all kinds of modding possibilities, and lets you freely use Interfaces and events and all to your heart's desire

visual stag
#

ScriptableObjects are my life

blissful burrow
#

I'll probably just end up using the same method I did for Shader Forge ¯_(ツ)_/¯

cedar reef
#

ScriptableObjects just suck because they suffer from all Unity's serialization limitations

blissful burrow
#

Which is, yeah, that, ScriptableObjects everywhere

#

ScriptableObject has less limitations, no?

#

You can have actual object references

#

With no duplication shenanigans

visual stag
#

Just put a scriptable object inside of a scriptable object and then you have less everywhere

blissful burrow
#

Yeah

cedar reef
#

Still can't do Interfaces, or generics (without making a concrete implementation)

visual stag
#

I feel like those are the limitations you just live with and work around when working in Unity

blissful burrow
#

Ah, well, yeah, but that's a limitation for any serialized type, not just ScriptableObject, no?

visual stag
#

Unless you want a custom serializer and deal with nobody being able to use your product

blissful burrow
#

oh no, custom serialization

#

: <

visual stag
#

(by that I mean, like Odin, custom file writing is fine, just a pain :P)

cedar reef
#

Yeah, it's best to just live with the lack of Interfaces and generics; I've learned to deal with it

blissful burrow
#

I usually don't use interfaces anyway~

#

I've always found that I want them to me multiple inheritance rather than what they are

cedar reef
#

At least when they introduced UnityEvents it was a big boost for being able to decouple

blissful burrow
#

I want Interfaces with method bodies and fields ✨

cedar reef
#

I love Interfaces...I believe using abstractions is really helpful

blissful burrow
#

I've almost never needed that, but maybe it is because I don't see the cases where it would be beneficial

#

or because Unity has made me used to not trust them and so I don't think they exist

cedar reef
#

They're great for decoupling, so you don't have to rely on a concrete implementation, which has a lot of benefits

visual stag
#

I use them often enough, though I definitely find myself making classes first 😛

cedar reef
#

I've come to be really into UnityEvents as a way to decouple, they're really a pretty powerful tool

visual stag
#

I love and hate them

cedar reef
#

It's essentially Dependency Injection

visual stag
#

They make following behaviour really difficult, but they're great for artist implementation

cedar reef
#

Yeah, events can be a pain to visualize, although not so bad if you follow in the debugger

#

Despite the downsides, I still feel like they bring a lot of benefit by essentially giving you a Dependency Injection framework, and yeah, by making it easy for designers and artists to do a lot of neat things without having to bug you to make special code

#

As long as you don't go changing the event's type to add another parameter after you make it the first time, leading to a bunch of prefabs breaking and having to be have all their events wired up again

blissful burrow
#

I think I managed to work out a neat pattern for serialization now

visual stag
#

watcha buildin'

blissful burrow
#

Basically each class that requires referencing, extends a type that extends ScriptableObject, and that type keeps track of its child objects, so that when the parent is destroyed, the children are too

#

Also with undo support, optionally

#

I'm tinkering with some ideas for Shader Forge 2

#

Although it's mostly noodling around at this point, but I've written a bunch of design notes

#

I've got a pretty good grasp of what I want to do and why it has value, even with Shader Graph being a thing that exists

visual stag
#

Interesting, I would have thought the time's wouldn't have been kind seeing as there's Shader Graph and Amplify

blissful burrow
#

SF/SG/Amplify all occupy the same space

#

So, uh, let's see if I can stitch together an elevator pitch 🤔

#

The above editors, are all super neat, and user-friendly, and great! They allow artists to super easily and quickly make something pretty and good with shaders. But, as soon as you want to create specialized shaders, or advanced multi-pass shaders with very precise optimization - you need to hand-edit

#

That's what I do today basically

#

But!

#

What if, there was a node based shader editor, that was just as low level, and gave you just as much control, but with the convenience of all the things node editors give you?

#

That's the space I want SF2 to sit in

visual stag
#

Sounds very cool, I definitely see that space as lacking

#

but I wonder if Shader Graph will head there soon enough

blissful burrow
#

Yeah, I find myself using SF a ton, until I need those types of shaders. And it's frustrating, because it's so much slower to hand-edit shaders

#

They might, and I should probably ask Unity to see what their plans are

#

Before committing to this

#

But I doubt they would make a shader editor go more low-level, I'd guess they would push more for the artist and ease-of-creation audience, since it's more popular and easier to market

visual stag
#

That'd probably be my thought, I've got a similar situation where I wanna make stuff but am afraid I'll just be competing

blissful burrow
#

Yeah

#

I actually had this happen very recently

#

It made me really hecking sad : <

visual stag
#

I doubt it'll be a priority for them, but I can imagine them heading that direction

#

The extent of VFX graph really surprised me in the level of control a node graph can have as developed by Unity

blissful burrow
#

I had been working on a recorder plugin for Unity for several months, you know, to record .gifs/.avi from the editor, but then as you already know, Unity released their own recorder, and it matched my feature set to 95%, so there's no way I would be able to have people use mine, and the 5% uniqueness of mine is probably not enough to sell people on it 😦

#

Which sucks because I was so hecking happy with the results of it

visual stag
#

I was working in the virtual production space when it happened and it was very good because it was like "yaaaaay I don't have to use my hack any more!"

#

So many tools I made just got rolled into the editor in the space of a year

#

But in my case there were so many things on the go it was good to not have to be in control of more software 😛

blissful burrow
#

Hehe, I can imagine

#

This was recorded with my recorder

visual stag
#

I remember seeing these tweets

blissful burrow
#

The one feature I had that Unity's didn't, was temporal interpolation, or, actual real motion blur

#

At least I don't think they had that

visual stag
#

I think they were just relying on the post effect

blissful burrow
#

Yeah, which isn't as neat!

visual stag
#

Also outputting the vectors and stuff and doing it externally

blissful burrow
#

Post effects wouldn't get you this

visual stag
#

How does that stuff even work? I assume you're still using velocity vectors?

#

Seeing as it's radial and all...

blissful burrow
#

I render subframes!

#

You specify quality of blur, which is the number of subframes per frame

visual stag
#

Ah, so similar to what Unity's done with Sherman

blissful burrow
#

Maybe? Not sure what they did

#

I thought they made real-time stuff?

visual stag
#

down at "Filmic Motion Blur / Super Sampling"

blissful burrow
#

Ah yeah! Sounds about the same

visual stag
#

Though you must note that theirs does not do it automatically, and you actually have to type in "960" into the rendering settings and swap it back by hand

blissful burrow
#

Oh, haha

#

This is one of my favs, showing the motion blur in action proper, haha

visual stag
#

That's awesome

#

Do you have any screenshots of the UI or is that not much to look at 😛

blissful burrow
visual stag
#

Ah the ol' helpbox vertical scope, my favourite 😃

blissful burrow
#

Augh, still makes me sad, I spent so much time writing this

#

All I had left was to polish up the real-time recording, and record audio too

visual stag
#

Should be glad you never got to the audio bit

#

Recording audio suuuuuuucks

blissful burrow
#

It was low prio, I might've skipped it depending on how tricky it would be to get that right in combination with the throttling to render all the blur frames and whatnot

visual stag
#

I wonder if any of the audio stuff gets better now with DSP Graph...

humble remnant
#

your recorder window looks easier to read than unity's

also the idea of a SF2 filling that gap where resorting to hand-writing code usually occurs is great.
I think any sort of useful visual debugging in-graph (similar in spirit to some of what unreal offers) would be nice too.
Most of my shader work now involves bouncing between code and renderdoc captures just to verify how certain things look and check values.

#

(and also fixing my dumb mistakes)

mellow shale
#

Is it possible to default Unity to place new gameobjects at the bottom of the hierarchy when they are dragged into scene?

#

When they get added to the top they get mixed in with my managers etc, which I don't want to delete by mistake.

blissful burrow
#

Thanks for the feedback @humble remnant !

waxen sandal
#

To be fair, if SF2 was just a visual debugger for shaders it would be amazing

blissful burrow
#

What do you mean by visual debugger in this case? Like, being able to see each step along the way?

#

But yeah, that would involve writing a CG/HLSL parser, which is quite a lot of work

waxen sandal
#

I didn't say it was easy 😄

blissful burrow
#

Hehe

#

That being said, I'd love to write my own shader language, that would be a super interesting challenge!

#

Although nobody would use it, but, still!

molten dock
#

I've got a slider set for 0-100 but I can only start moving it if I click around 12 first. I can't select the slider before that

#

Anyone seen this before?

blissful burrow
#

Sounds like the width of the element might be too small or something?

#

Even though it visually spans a larger area

#

How do you define the slider?

molten dock
#

I just created it in the editor

blissful burrow
#

How?

waxen sandal
#

Which UI do you mean?

molten dock
#

right clicked on Canvas > UI > Slider

blissful burrow
#

Since this channel is more specifically editor scripting

waxen sandal
molten dock
#

ah ok

waxen sandal
#

I'd guess something is on top of the first part of the slider though

molten dock
#

so many channels here... hard to decide

waxen sandal
molten dock
#

@waxen sandal you are right actually! I see my text label is too long DOH!

blissful burrow
#

molten dock
#

sometimes it's the simple things

blissful burrow
#

So, to return to the channel topic - in UIElements, how do I get a MouseUp event that isn't bounded by the element?

#

For instance, right now I'm making a draggable thing, and I want to stop dragging it OnMouseUp

#

But the problem is that OnMouseUp can happen outside the thing, and the event won't fire

#

I basically need a global OnMouseUp regardless of where you released

waxen sandal
#

Can you subscribe to the mouseup of the root object?

blissful burrow
#

Hm, I guess, seems a bit, oddly convoluted though

waxen sandal
#

Otherwise good old Event probably works

blissful burrow
#

Wish there was like a, RegisterRawCallback or something

#

But then I'd need an OnGUI loop

waxen sandal
#

True

#

There's probably a good answer but I haven't really used it 😅

blissful burrow
#

I'll go for the root mouse up for now!

waxen sandal
#

You could look at the source of shadergraph

#

They probably do the same thing

blissful burrow
#

It's, pretty involved, seems easier to just roll my own!

#

I didn't look this up specifically though, I probably should

waxen sandal
#

Haha yeah

#

Make the drag specific events?

blissful burrow
#

Those are for drag and drop functionality specifically though

waxen sandal
#

That's what I was assuming you were doing 😛

blissful burrow
#

Drag and drop as in, assigning data by dragging an item with said data to some container target

waxen sandal
#

Oh

blissful burrow
#

I want to just drag it to change its position!

waxen sandal
#

That's confusing

blissful burrow
#

Ah! Found a thing

#

elem.CaptureMouse

#

heck yeah that works

#

Okay, so, calling CaptureMouse() on press, seems to imply that you get all mouse events regardless of where they happened, until you call ReleaseMouse()

waxen sandal
#

Ah nice

#

That's pretty handy

blissful burrow
#

Yeah

waxen sandal
#

Thanks for letting me know 😄

full lagoon
#

Can someone let me know why two objects with the same coordinates aren't instantiated in the same position?

stark geyser
#

@full lagoon There could be number of reasons for this. Please use #💻┃code-beginner to show the code how you are instantiating them. This channel is for extending the Editor.

grand robin
#

Does anyone know how to edit the search field in the hierarchy programmatically?

cedar reef
#

You can't, as far as I know

#

It might be possible via some reflection fanciness

static nexus
#

When I try building my game it fails because of these errors, however I don't get these errors while the game is running or when working in the editor.

#

Well I'm an idiot, the folder the scripts were in was called "EditorScripts" instead of "Editor", problem solved.

idle anvil
#

alright, it seem i managed to fix most of bugs but i have no idea why i got this:

primal steeple
#

Anyone have any ideas of how to copy a serialized property in the editor, and paste it into another serialized property of the same type on a different object? Similar to copy component values on the inspector but instead for structs / classes that don't inherit from UnityEngine.Object

slate pecan
#

@idle anvil that's most likely a Unity bug

idle anvil
#

how interesting

slate pecan
#

all the code in the stack trace is from Unity

idle anvil
#

is there a way to know which version of .net is?

slate pecan
#

restart might help

idle anvil
#

i did that too

#

but it keeps persisting

slate pecan
#

.net version is set under Player settings

#

just note that .net standard 2.0 is newer than .net 4.x

idle anvil
#

good to know

#

thx

timid cobalt
#

I am trying to display a unity event in an editor window and I have it shown but when I hit the + button on the unity event it says add to list but nothing else happens and it doesn't add a new event.

cedar reef
#

It might be tied to code that expects it to be in a custom inspector...could be the only way to get it working would be to recreate the functionality

timid cobalt
#

How would you recomend I do that

#

I dont know how I could do that

#

@cedar reef

cedar reef
#

It wouldn't be something that's easy to do, or summarize how to do

#

Ha, found a page with a solution, but it looks like you already found it and it doesn't work

timid cobalt
#

Ok

timid cobalt
#

Do you know any place where I could find how to do it

#

@cedar reef

#

I have looked around

ruby needle
#

https://docs.unity3d.com/ScriptReference/AssetDatabase.AddObjectToAsset.html
Is there a way to add GameObjects/Prefabs as sub-assets of other assets? The above method apparently works for everything except for GameObjects.
The documentation does mention You can not add GameObjects; use PrefabUtility instead. which makes me think it is possible, but unfortunately it doesn't mention how exactly.

timid cobalt
#

Does anyone know how to have a place where you can drag a script in a custom window.

#

I don't know the technical name for it

grizzled minnow
#

I think EditorGUILayout.ObjectField is worth a try

craggy holly
#

Hi, opening Visual Studio after a compile takes 10 secs.
I think that its because it syncs all the assembly data to allow a nice debugging.
mi questions: There is a half-way, between attaching editor to VS and disable the debugging,?
For example a manual sync, just before debbuging?

granite ledge
#

attempting to snap all of the prefabs to ground with this script and the y value is all set to -49.95 or something like that

#

which is quite incorrect, not even close

#

however the code works fine when used singularly and not in a for loop

#

if you have any idea how to iterate through some terrain snapping action without getting this inexplicable glitch, ping me plz

#

rlly hate doing that manually

whole steppe
#

GetLength(0) will not work

#

use .Length

granite ledge
#

makes no difference at all

#

just tried it

#

still flattens the prefab way below the terrain, does not snap them to it.

#

changes nothing at all

glad quiver
#

What the... You can't even modify SphericalHarmonicsL2 struct?
Who came up with this decision?

#

It's extremely baffling. How am I supposed to do light probe editing then?

#

Can we at least get the data that is stored in those structs in order to wrap them around our custom structs?

#

And hey, look, someone actually COULD modify the coefficients on github, but the api is completely obsolete and the new one points to SphericalHarmonicsL2 structs, which are, again, not explicitly modifiable

#

And there is no proper constructor for the struct

#

I really, really want to know the logic behind this decision.

visual stag
#

I've got no clue about spherical harmonics, but looking at the source, can you not index into it like an array?

glad quiver
glad quiver
#

Wonder why there was no info in the docs that it has a multidimensional array accessor

glad quiver
#

I'm genuinely sorry

visual stag
#

Hah, it looks like you've genuinely looked at least :P
We all make mistakes

quaint glade
#

Hey guys, can anybody help me out. I'm trying to write a little assetPostprocessor script to help me out.
I have this fbx file containing various meshes. I want to create prefabs for each of these meshes, so a unique prefab for each mesh.

I have so far succeeded in creating a prefab for the whole thing using PrefabUtility, but this contains the whole fbx with all meshes etc.

What would be the best way to do this? Should I create a new object, add a meshfilter to it, copy over the data from the source, and turn this into a prefab etc, would that work? Is there a better way? Thanks

visual plover
#

Does anyone know of a good way to hide a GameObject in the hierarchy but allow it to be selectable and select the parent instead when clicked in the SceneView?

lucid hedge
#

does anyone have a good library for adding reorderable lists in editors?

#

I'm looking for something clean and simple, does not have to have a lot of features

cedar reef
lucid hedge
#

I'm actually looking for a pretty native looking list

#

like this one, but I think I'm just going to dig into the unity code on github and check how they do it 😃

#

after all there is a ReorderAbleList class

lucid hedge
#

got it 😃

willow stone
#

Hello, does anybody know if its possible to get a global callback when a user clicks on a property in the inspector? (not a custom inspector, but any inspector)

lucid hedge
#

Is there a way to make an actual native looking 'component' like the Line Renderer for example

#

so complete with icon, checkbox and without the '(Script)' behind it

regal jasper
#

@lucid hedge not sure about removing the (Script) from it, but to change the icon is very simple: https://docs.unity3d.com/Manual/AssigningIcons.html

For the checkbox, it automatically appears if you have OnEnable/OnDisable/Start/Update/etc funcions on your script (as it is directly equivalent to the enabled property, which only makes sense on the presence of those Unity methods)

lucid hedge
#

thank you!

#

And I have another question regarding handles

#

I draw these white handles in the scene and I want to know when my mouse is going over them

#

I can use Event.mousePosition and then convert that 2D position to a world space ray

#

but how do I check for intersection?

#

or should I convert the 3d position of the handles to 2D position and compare those with Event.mousePosition?

grizzled minnow
#

You can create a new "selection" Rect of 10-20px at the handle location in screen-space, then check Rect.Contains(mousePosition) to see if the mouse is hovering over it

visual portal
#

hi, can someone explain what does this mean =

#

NullReferenceException: Object reference not set to an instance of an object
PlayerMovementScript.Awake () (at Assets/Scripts/PlayerMovementScript.cs:19)

whole steppe
#

guys so i have a problem with a script
I am trying to make a simple script that changes the color in the sprite renderer (im in 2D)

#

after trying a lot of things it didnt work

#

if anyone can help i will show him the script

gritty grail
visual stag
#

@visual portal @whole steppe This channel is for extending the editor. General code questions should go to #💻┃code-beginner

whole steppe
#

Ok

lucid hedge
#

@grizzled minnow thanks! I already have another way to handle it but I'm gonna try that too

brittle cosmos
#

How would I create an editor window similar to the sprite editor?

#

As far as I can see, EditorWindow can do buttons, inputs, etc. but how would I be able to do things like drawing a sprite, handling mouse input for things like dragging/removing/adding points?

shadow violet
#

Does anyone know if theres an asset that acts like the old prefab system? Im thinking of making one to solve a few annoying issues I have with the current system to work as closely and efficiently as the old one, but if theres already one that exists, ill just import and use that

broken helm
#

Hey can anyone help me?

stark geyser
#

@broken helm Don't ask to ask across multiple channels, pick one relevant to your issue and ask the actual question.

tough cairn
#

@brittle cosmos there is a way to get the mouse input, iirc it can be accessed via Event.current

#

Also u can draw textures on GUI

#

But it might be very CPU demanding ( depending on the size and draw frequency ofc... )

#

In that case, you might want to use smaller textures and scale them up

GUI.Label (Rect (200, 200, 32, 32), textureToDisplay);
GUIUtility.ScaleAroundPivot (Vector2(1,1), Vector2(3,1));
brittle cosmos
#

Thanks that thread seems useful.

#

And it seems you can use GL commands

visual stag
#

@brittle cosmos you need to provide a shader with the following additions:

sampler2D _GUIClipTexture;
uniform float4x4 unity_GUIClipTextureMatrix;

struct v2f {
    float2 clipUV : TEXCOORD1;
}

v2f vert (appdata_t v) {
    float3 eyePos = UnityObjectToViewPos(v.vertex);
    o.clipUV = mul(unity_GUIClipTextureMatrix, float4(eyePos.xy, 0, 1.0));
}

fixed4 frag (v2f i) : SV_Target {
    col.a *= tex2D(_GUIClipTexture, i.clipUV).a;
}```
#

You can see that in context in the built-in shaders

brittle cosmos
#

Perfect thanks

brittle cosmos
#

Why doesn't GUILayout.EndScrollView(); have the handleScrollWheel option?

#

It's all good, Event.Use does the trick if I want to use the scroll wheel for something else

#

Why are my scrollbars cutoff slightly, and the toolbar at the top has some extra spacing on the left and right?

#

This is all I've got:

GUILayout.BeginHorizontal(EditorStyles.toolbar);
_options = GUILayout.Toggle(_options, "Toggle Me", EditorStyles.toolbarButton);
GUILayout.FlexibleSpace();
GUILayout.Toggle(_options, EditorGUIUtility.IconContent("d_PreTextureAlpha"), EditorStyles.toolbarButton);
GUILayout.EndHorizontal();
scrollPosition = GUILayout.BeginScrollView(scrollPosition);

So I'm not sure what could be causing it

visual stag
#

Use the GUIView/IMGUIDebugger to figure out what's causing what

#

Info about it is pinned

brittle cosmos
#

Hmmm, that hasn't really helped me.

tough cairn
#
scrollPosition = GUILayout.BeginScrollView( scrollPosition, GUILayout.Width( Screen.width ), GUILayout.Height( Screen.height ) );
#

@brittle cosmos adjust width and height as needed

brittle cosmos
#

But that just creates one of fixed size. I'm using GUILayout so it automatically fills available space.

tough cairn
#

I would wrap it around another container and give it extra space on the edges

#
GUILayout.BeginHorizontal();
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
GUILayout.Space( 10 );
GUILayout.EndHorizontal();
#

then wrap it again with vertical layout, etc...

visual stag
#

Everyone should use the Scope versions of these functions, they're so much nicer 😛

tough cairn
#

Also if you dislike how amazing this looks, it is also possible to give margin / padding ( don't remember which one is supported ) via GUIStyle

#

@visual stag ah yes, my code is full of those

#

i find them very flexible

brittle cosmos
#

Well the spacing thing worked I guess. I'm not going to fuss over it too much.

#

?

visual stag
#

Yes, that and HorizontalScope, and VerticalScope

brittle cosmos
#

So what's the advantage of using that?

visual stag
#

You cannot fail to close them

#

they come with the indent of a using block so it's more visually apparent

#

That's about it really

tough cairn
#

I used to do this before

GUILayout.BeginHorizontal();
{
    GUILayout.Space( 10 );
}
GUILayout.EndHorizontal();
brittle cosmos
#

Ok I'll keep that in mind

brittle cosmos
#

So do I split up code based on the event type?
Eg. should I only use GUILayout.XXX during a layout event?
And only handle input during MouseDown, MouseDrag, etc?
And what's the repaint event for?

visual stag
#

Some code needs to be split, but most of the general functions don't

#

The layout stage is a pre-processing stage where the rects are calculated for the repaint stage where everything is drawn. The repaint stage cannot differ in draws from the layout stage

brittle cosmos
#

Thanks I'll give it a read

zealous ice
tough cairn
#

Not sure if it's relevant but i do remember finding a repo on github that had showed custom irons in the hierarchy view

#

If you hack/override the panel or clone it, then it should be possible

#

( that's jump my opinion i didn't check my claim )

finite marten
#

I have some ScriptableObjects that I would like to auto-save to disk when the values change in the Inspector and/or Editor Window. Right now I am using the OnValidate() callback on the ScriptableObject and then calling EditorUtility.SetDirty() & AssetDatabase.SaveAssets(). I think this rewrites the whole asset file though. Is there a more efficient way to do it where only the modified values are written to the asset?

mellow hatch
#

Is it ok if I draw handles in OnDrawGizmos or do they need to be drawn in OnSceneGUI?

smoky radish
#

Hey guys,
I put an array in the EditorWindow like this;

public class Example : EditorWindow
{
    public Sprite[] sprites;

    private ScriptableObject _target;
    private SerializedObject _serializedObject;
    private SerializedProperty _spritesProperty;

    [MenuItem("Tools/Example")]
    public static void ShowWindow()
    {
        GetWindow<FillFields>("Example");
    }

    void OnEnable()
    {
        _target = this;
        _serializedObject = new SerializedObject(_target);
        _spritesProperty = _serializedObject.FindProperty("sprites");
    }

    void OnGUI()
    {
        EditorGUILayout.PropertyField(_spritesProperty, true);

        _serializedObject.ApplyModifiedProperties();
    }
}

The problem is when I drag and drop some sprites together into the array, the order is not same as in Project window. What is the problem ?

shadow violet
#

The Project view is always in alphabetical order to my knowledge, selection arrays will always be in the order you select in, and if you shift-select, it's always reverse for some reason, so you could use linq and sort it alphabetically if that's what your going for o.o

smoky radish
#

I've never seen it in reverse or anything. It is always in alphabetical order in Inspector.

#

Editor Window Order:

#

But order for scriptable objects which I've created before is correct in Editor Window.

feral karma
#

For scripting mesh access, there seems to be some peculiarities around mesh.isReadable. In Edit Mode it does not matter (always readable as per the docs), but in Play Mode meshes are always accessible from the editor but actually use isReadable inside the Game Loop.
I found "Mesh.canAccess" in the CsReference, but that is internal. Is there any way to figure out whether a call is currently inside the GameLoop?

glad quiver
#

Is it not possible to modify the values of Occlusion Portal from the script?

#

The only public value related to the component is "open". It doesn't seem that it's possible to edit its bounds

#

Why is that?

shadow violet
#

@smoky radish I think you'll just need to call a linq order by, or a generic collections list sort on it, before you display it, if you Havnt fixed it already

tribal skiff
#

hello...editorWindow has common problem of not saving values i used serializing to save my static class data which works fine in editor and playmode but...when building the data from editor isnt loaded why? :/

shadow violet
zealous ice
#

Hey, can you somehow detect changes made to Tilemap? I want to run some code when Tilemap's content is changed

tribal skiff
#

@shadow violet i searched alot for it, and yes there is other one its serilization or something like that and its easier, i finally managed to fix the problem thx :)

shadow violet
#

@tribal skiff mind sharing the solution? If be interested in trying it with some of my assets if it's better o.o

tribal skiff
#

oh yee

#

np man

#

w8 not finished

#

@shadow violet um... ur using static or just public and private fields? uhh nvm i will share the solution for the two, so no gets the pain of passing a day searching on google xD
Case 1 :

in the case your having a variable that can be serialized (https://docs.unity3d.com/Manual/script-Serialization.html in Serializable rules) i havn't tried it yet but i think it may work just do :-

    ***public or private*** ***your type*** *your variable name*;```

__**Case 2**__

     in case your variable cant be serialized like my case, then you gotta create a serializable clone for your original variable :-

```[SerializeField]
    ***private or public*** ***your original variable type*** *your original variable name*;```

    add the `, ISerializationCallbackReceiver` it should look something like :

``` public class SerializationTest : EditorWindow, ISerializationCallbackReceiver```

finally do :

```public void OnBeforeSerialize()
 {
     cloneVariable = Original;
 }
 
 public void OnAfterDeserialize()
 {
     //Original = cloneVariable ;  // uncomment this if you want the field to reflect the value of the static field on playmode
 }```
case 2 is   from https://answers.unity.com/questions/1551266/serialize-static-fields.html and https://answers.unity.com/questions/1238007/editor-window-serialization-not-working-as-expecte.html
shadow violet
#

Thanks for sharing that, ill have to check it out and try it tomorrow, but at least for me, its a lot of "user preferences" like a toggle "sort alphabetically" for example, so when they re-compile, that "sort alphabetically" state should persist - a lot of my variables are static cause the functions that need to call them are also static, and if I made them non-static I cant remember the issue I got, but I think certain functions just had compilation errors, but ill double-check tomorrow when I can work on it to confirm - thanks again for sharing n im sure itll help out others too

tribal skiff
#

np

green shoal
#

I'm having an Issue where my color field is not displaying the correct color
this is the code I'm using

coresTilesCorredor.TetoFEColor = EditorGUI.ColorField(recColor, GUIContent.none, coresTilesCorredor.TetoFEColor, false, true, false);
#

there is nothing under it, the slight red line is just my bad skill at cropping since these two aren't side by side :B

#

well, it started working with the addition of another undo.recordObject 😑

#

now I have two of them right next to each other, as long as it works?

frail phoenix
tough cairn
frail phoenix
#

someone at unity thinks they're funny

tough cairn
#

but it says exactly what it does. .. doesn't it ?

frail phoenix
#

bluring is not the same as removing focus

visual stag
#

Many APIs use Blur to mean unfocus

frail phoenix
#

really???

#

I find that hard to believe

tough cairn
#

semantics

frail phoenix
#

cameras blur

tough cairn
#

context awareness

frail phoenix
#

if you went to an eye doctor and they said "focus on the text" "good, now blur" you wouldn't think they were saying you could look somewhere else now

tough cairn
#

blur is the result of losing focus ...

#

causality ...

#

man relax

#

its just docs

frail phoenix
#

no, it's confusing

#

development is UIElements is at 1/8th speed because it's so confusing

#

and this kind of crazyness doesn't help

tough cairn
#

the problem in general when learning new stuff is the challenge of unlearning old stuff , anyway this is getting off topic 😛

frail phoenix
#

the problem with learning new stuff is that the new stuff isn't documented very well and uses terms that aren't very descriptive

tough cairn
#

tru

zinc peak
#

how do i acces a gameobject from another scene trough script

green shoal
#

Hey, is there a way to make a serializable color? I'm struggling to make a class/struct inherit from Color

regal jasper
#

Color is serializable already

#

and Color is a struct, you can't inherit from it

green shoal
#

really? I don't get why my script is not saving it then, it is saving everything else, but my struct with a bunch of colors inside

#

I'm using [System.Serializable] so that is not the problem, and it has the proper Undo.RecordObject, I have no idea what else it could be

raven cedar
#

hey all anyone had many dealings with exoplayer?

green shoal
#

Ok, just to be sure, when I'm saving an asset, I do it like this:

Undo.RecordObject(target, "saving dictionaries");
//make the changes
AssetDatabase.SaveAssets();

right? because when I change the colors on debug mode they carry on, whe I change on my inspector they appear differente, even on the debug, but don't carry on

visual stag
#

Dictionaries are not serializable

#

You would need to implement serialization with ISerializationCallbackReceiver if you're working with dictionaries

green shoal
#

yeah, I have that, but in this case I'm changing just a struct with a bunch of colors inside it

visual stag
#

If they're plainly appearing in the inspector without a custom UI (can check in debug mode) then they're serializable

#

So if that's happening you write it off as not that

green shoal
#

I'm saving exactly as I said up there, I'm kinda desperate right now, I have 0 clues to what is going wrong

visual stag
#

I think the only way to get to the bottom of it at this point would be to link to more code

#

You shouldn't really need to even call SaveAssets, as usually Unity kinda expects users to manually save changes to assets at some point

#

which can be a little volatile at points

green shoal
#

here is all the saving I'm doing, those are serializable dictionaries
myScript is the target
and everything in myScript is serializable as well, I tested it out of this asset

            Undo.RecordObject(myScript, "saving dictionaries");

            myScript.Test = Color.blue;

            if (myScript.myColorDictionary == null)
                myScript.myColorDictionary = new TileColorDictionary();
            if (myScript.mySecondTileTypeDictionary == null)
                myScript.mySecondTileTypeDictionary = new TileTileTypeDictionary();

            myScript.myTileDictionary = tempTileDic;
            myScript.myTiletypeDictionary = tempTypeDic;

            myScript.myColorDictionary = new TileColorDictionary();
            myScript.mySecondTileTypeDictionary = new TileTileTypeDictionary();

            foreach (Color c in keysUsed)
            {

                Tile comparer;
                Tiletype thetype;
                tempTileDic.TryGetValue(c, out comparer);
                tempTypeDic.TryGetValue(c, out thetype);

                if (comparer != null)
                {
                    myScript.myColorDictionary.Add(comparer, c);
                    myScript.mySecondTileTypeDictionary.Add(comparer, thetype);
                }

            }

            myScript.TilesCorredor.MyColors = coresTilesCorredor;
            myScript.TilesFase.MyColors = coresTilesFase;

            myScript.TilesCorredor.MyTypes = tiposTilesCorredor;
            myScript.TilesFase.MyTypes = tiposTilesFase;

            serializedObject.ApplyModifiedProperties();
            AssetDatabase.SaveAssets();

            Debug.Log("Saved " + myScript.name + " successfully");
visual stag
#

You cannot mix serializedObject.ApplyModifiedProperties and Undo

#

It's one or the other

#

either you're modifying SerializedProperties

#

or you're modifying target

green shoal
#

Good to know, I read on the site documentation to use Undo and also use the serializedObject.ApplyModifiedProperties()

#

but after the undo, do I do something else?

visual stag
#

It shouldn't need anything else

lucid bay
#

Been a while since I've done any video work in Unity and am tasked with building a desktop application that makes heavy use of video.

What currently is the best codec to use? Should I go with a lossless codec like HAP (larger file size)or stick to H.264? Also is there currently still any advantage in using a 3rd party video playback asset like AVProVideo(for Windows) ?

green shoal
#

I kinda lost some debugging lines when refactoring that made my object act weird like that, damn I hate the way I did this, should've stayed with lists instead of structs

frail phoenix
#

wow, that developer mode is a wild easter egg

#

how do you turn it off once you've turned it on?

visual stag
#

same way you turned it on

frail phoenix
#

👍

raven cedar
#

hey all anyone had many dealings with exoplayer? looking for a little advice

whole steppe
#
GUI.Box(rect, text, style);
#

how can i set the text to middle?

#

nvm got it.

#

new Question how can i place a TextField inside a GUI.BOX ?

#

is that possible?