#↕️┃editor-extensions

1 messages · Page 75 of 1

solid dome
#

I'm not sure, sorry 😦

quaint zephyr
#

it's persisting the InputActionAsset inputAsset just fine, but not the InputActionMap activeMap field. The inputAsset get's updated via SerializedProperty but the activeMap get's updated through target as InputModule.ActiveMap property. That's the one I need to figure out how to persist.

onyx harness
#

Because you are assigning directly to the target and not through the SerializedObject

quaint zephyr
#

I figured, but how can I assign through the SerializedObject? I tried this the first go around, but it would throw errors because the InputActionMap is NOT deriving from UnityEngine.Object so using serializedObject.FindProperty("activeMap").objectReferenceValue = newMap as object as Object; doesn't work.

severe python
#

how can I cast a ray into my scene view on mouse click without changing my selection in the process

#

is there a way to prevent the selection change event?

quaint zephyr
#

someone then suggested I use a C# property to update the value. Which I did here.

severe python
#

I specifically intend to, make a button to enable a tool, the use clicks on some geometry in the scene, and then it shows the results of that click

onyx harness
#

Because you don't use SerializedObject properly

severe python
#

its for testing path finding

quaint zephyr
#

Can you help me figure it out with this field? If I can figure this out, I'd be able to understand how to do it for the rest of my life lol.

#

Been at this for 2 days now 😦

onyx harness
onyx harness
#

Thx god Discord implemented Answer To

severe python
#

right?

quaint zephyr
#

So in the InputModule class, I really don't need ActiveMap property, I only created that to get this custom editor to work. I really just need to serialize and update private InputActionMap activeMap

#

Did you need me to post the code again?

severe python
#

I mean, interception isn't strictly required

#

though, I do really look forward to the editor design improvements in 2021

quaint zephyr
#

NNOOO!!!!

onyx harness
onyx harness
#

It will never be persisted.

quaint zephyr
#

Any "workarounds"?

#

Perhaps I can store string value and have the inspector overwrite the inputMap by the stored string value?

#

sounds logical no?

onyx harness
#

I guess that is what you are looking for

quaint zephyr
#

Ok. I will try.

onyx harness
#

Unfortunately, I don't know what are InputActionMap

quaint zephyr
#

It's a class from Unity's InputSystem

onyx harness
#

InputAsset will be persisted, but not the rest

quaint zephyr
#

public sealed class InputActionMap : ICloneable, ISerializationCallbackReceiver, IInputActionCollection, IDisposable

onyx harness
#

Ok

quaint zephyr
#

And it actually has [Serializable] in the source code!

#

So why isn't it serialized?

onyx harness
#

Yes, but it is private

quaint zephyr
#

The class is private?

onyx harness
#

The field.

quaint zephyr
#

Can I put [SerializeField] then and do that?

onyx harness
#

You did it just before with inputAsset

#

Yes

quaint zephyr
#

Hmm..let me try the attribute first lol

#

Ok. here is result. I at least got one foot in the door now! So I [SerializeField] that field, and as a result, if I "inspect" the prefab (without switching to prefab mode), the value persists, and when making a new instance of it during runtime, the value persists! YAY.

#

BUT! When I enter prefab mode, the value is reset. And it doesn't matter what I set it to, when I leave Prefab Mode, it doesn't persist to the prefab when I "Inspect" it, and when I go back to Prefab Mode, the value resets.

#

So it's very strange behavior. What else must be done for it to persist to Prefab Mode?

onyx harness
#

Because you don't assign the value properly

quaint zephyr
#

Ok. How can I assign the value properly? 🙂

onyx harness
#

You are toying with the target directly instead of SerializedProperty

quaint zephyr
#

Oh, back at this are we? lol

onyx harness
#

In the reality, you can do it both ways

#

But you are not using SerializedProperty correctly still

#

Yes

#

Let me explain

quaint zephyr
#

I would MUCH rather prefer using SerializedProperty over target any day, but as I ran into that wall since the InputActionMap is not a UnityEngine.Object 🙂

onyx harness
#

Well then just get the right SerializedProperty and assign it

quaint zephyr
#

That's why I'm using target and doing all this work so I can get around this wall

onyx harness
#

FindProperty('activeMap.WhateverField') =

quaint zephyr
#

Ok. Let me should you what Unity says when I try to do it the proper was (as I have done the first go around) 😛

onyx harness
#

Type pptr?

quaint zephyr
#

Yes!

#

That's the one

#

annoying af

onyx harness
#

Because you don't do it correctly

quaint zephyr
#

Ugh.

onyx harness
#

What do you want? Change an integer?

quaint zephyr
#

No. I want to change the entire object

onyx harness
#

A string?

quaint zephyr
#

A InputActionMap

#

that is [Serializable], but doesn't inherit from UnityEngine.Object

#

I know how to change integers, strings, and any MB derived class. That's basic 🙂

onyx harness
quaint zephyr
#

Will do. How come?

onyx harness
#

I was going to explain that earlier

quaint zephyr
#

Sorry

onyx harness
#

When you deal with SerializedObject, you are working on your target, which is a Unity Object.
The SerO is the C# representation, a bridge, to the C++ side where the real data lives.

quaint zephyr
#

Ok, this I know so far...

onyx harness
#

When you toy with target directly , you change the Object in the C# managed side.

#

But the real data in the C++ side remains unchanged!

quaint zephyr
#

Which I don't like anyway.

#

I understand this.

#

But I'm trying to get around the pptr exception

#

while swapping out inputMap through the SerializedProperty route.

onyx harness
#

By calling Update(), you request C++ to update its representation of the Object from the managed side

quaint zephyr
#

Oh. There we go. Now that is new for me 🙂

#

I will remember this.

#

So I must UPDATE the managed site, THEN call Update

onyx harness
#

You can not set the InputMap directly. because it's not a Unity Object but a pure C# class

#

BUT, SerializedObject of course allows you to set its fields

#

Yes.

#

Same for ApplyModifiedProperties()

#

This one is useless

#

Because you never actually use any SerializedProperty

quaint zephyr
#

ApplyModifiedProperties is like Update, but backwards yeah?

onyx harness
#

Yes

#

In your case, you go from C# to C++

quaint zephyr
#

Aha. Ok. Let me try and see if I can tweak this some more 😉

onyx harness
#

While I understand that Apply is also C# to C++

#

This one talks directly through the bridge of SerializedObject

#

And SerializedObject handles undo and stuff

#

Which is convenient

quaint zephyr
#

So Update persists managed to serialized. And Apply from serialized to managed, correct?

onyx harness
#

Yes

#

Either choose one path, but avoid doing both, or you just need to correctly understand the principles running behind

#

Remember that SerializedObject also handles dirtying

quaint zephyr
#

Yeah dirtying is something I haven't gotten to learn yet.

onyx harness
#

Without that, maybe the data won't get saved to disk

quaint zephyr
#

Ok, moving Update to where you told me didn't work either. So let's try this 'dirtying' how would I implement this?

onyx harness
#

No no, better way of checking, read the file directly

#

Or just dirty the objectthrough code and save to disk

#

and check the content of the file

quaint zephyr
#

How do I throw some "dirt" on it?

onyx harness
#

try https://docs.unity3d.com/ScriptReference/EditorUtility.SetDirty.html

quaint zephyr
#

You know, if Unity doc was exhaustive, I probably wouldn't be here asking you all this 😛

#

All I understood is that in the case of modifying Prefab itself, I need to mark dirty because it's a non-scene.

#

Do I just slap SetDirty at the end of the script? Or does I need to meet some condition?

onyx harness
#

Use it when you actually change the Object

#

which is line 40

quaint zephyr
#

So set dirty right before I change the data? Or right after?

#

or doesn't matter?

onyx harness
#

after

#

Does not really matter

#

But it's better to put it after

#

It's more logical

quaint zephyr
#

Ok, so basically I will slap this in right before the Update call

onyx harness
#

The change havn't applied yet

#

Why would you dirty it if you did touch it?

#

What if an exception is raised in between?

quaint zephyr
#

good point

#

and for the object, I just set it to target right?

#

the paramter?

onyx harness
#

You don't write a log "Done" at the beginning of an operation

#

Yes

quaint zephyr
#

Ok, let' esee what happens

onyx harness
#

The prefab should become kinda bold

#

or the name gets an "*"

quaint zephyr
#

My MAN!

#

It works!

#

@onyx harness Thank you so much, not just for the answer, but for the explanation! You should have Unity pay you to write their docs man! For real.

onyx harness
#

The day I will release my tutorials, a lot of things like that I will explain

quaint zephyr
#

Sign me up!

onyx harness
quaint zephyr
#

2 days wasted, when I could've just asked you 😉

onyx harness
#

Another thing

#

I was not really into helping you for a simple reason: Your case explanation is shit.

#

Sorry let me rephrase

#

I was not really eager to help you

quaint zephyr
#

Oh I understand, I didn't make it clear what I wanted. You had to figure out some things along the way? That sort of thing?

onyx harness
#

If you don't bring fact, code, the situation, what you tried and stuff, I will just feel you are passing and try to grab things as is

#

And I am really not the type of guys that is going to code for you

#

Exactly

quaint zephyr
#

I feel like if I posted what I tried...it would clog up the chat lol. I normally reset to discord when I can't find useful stuff online for what I want.

onyx harness
#

I am here willing to "teach" people, not to get points reward (That's why I like Unity Discord, no gamification like other Discord)

quaint zephyr
#

Docs first, then Google, then forums, then trial and error, then discord, then baseball bat to the computer.

onyx harness
#

My goal is for you to never return here, because you will understand what you do, and not just copy paste

quaint zephyr
#

I'm actually doing all this to learn the internals myself, not just to run through it.

onyx harness
#

And you did well

#

So, i'm glad you got it first shot

quaint zephyr
#

I wish it was first shot. Many many shots before I talked to you.

#

Anyways, big thanks again.

onyx harness
#

You are lucky Gary answered you and you dropped the code

quaint zephyr
#

Indeed. Thank you @solid dome you saved the day!

onyx harness
#

Otherwise I wouldn't have even looked at your case

#

Keep up the good work and good luck in your journey

solid dome
#

Lol glad to have helped I guess!!

quaint zephyr
#

@onyx harness I have another question, piggy backing from the previous solution. If my field is [SerializeField] private can I (from the custom editor) update the value using Reflection? If so, would that persist between C# and C++?
I am assuming Reflection is a parallel concept to what SerializeProperty does?

#

Or is that just bad practice?

onyx harness
#

yes

#

Reflection is just toying with the managed side

#

It is the same as assiging a value to target

#

Exactly the same

quaint zephyr
#

Oh ok, So Reflection doesn't touch C++ at all huh?

onyx harness
#

Nothing related yep

quaint zephyr
#

Understood.

#

Was just trying to see if I can eliminate the property that set that non Unity object value whilst keeping it private

onyx harness
#

Eliminating it is easy, you just need to assign its fields directly

#

In your case, the property is handy

quaint zephyr
#

Agreed.

#

So from what I gathered. I can setup a bunch of items, and if any of them are changed I can make a bool dirty to true. Then at the end I can update, set dirty, and apply? Or do I need to update after each item?

onyx harness
#

Yes, you can update and dirty at the end

#

No need to apply, since apply is for SerializedProperty

quaint zephyr
#

I added a bool, and it’s not changing. I’m reading it serializedObject.boolValue and setting it the same way with Apply at the end. Now I feel like an idiot because this is basic stuff lol. I won’t bug you with this before I try everything out first though.

quaint zephyr
#

Ok, I figured out what the issue was, but I can't understand why.
if I directly do this:
p_isActive.boolValue = EditorGUILayout.Toggle("Is Active", p_isActive.boolValue); The changes persist.

But if I indirectly do this:

bool activeState = EditorGUILayout.Toggle("Is Active", p_isActive.boolValue);

            if (activeState != p_isActive.boolValue)
            {
                p_isActive.boolValue = activeState;

                var map = inputMaps[activeMapIndex];
                if (activeState)
                    map.Enable();
                else
                    map.Disable();
                dirty = true;
            }

The bool doesn't update in inspector. I verified that the if statement actually does get triggered (via debug log), so I know for sure that p_isActive.boolValue = activeState; get's processed. But it doesn't persist!

What is the difference between this and directly doing it?
Keep in mind I need to "watch" this change so I can modify the map state.

#

FYI, With the indirect option, everything else persists as it should.

#

Also, another FYI, I am ApplyModifiedProperties at the end as well. That gets called for sure.

#

I got it to work with the following solution. But I feel it's a bit "dirty", can you suggest something I'm missing, or is this the only way to go about.

bool activeState = p_isActive.boolValue;
            p_isActive.boolValue = EditorGUILayout.Toggle("Is Active", p_isActive.boolValue);
            serializedObject.ApplyModifiedProperties();

            if (activeState != p_isActive.boolValue)
            {
                var map = inputMaps[activeMapIndex];
                if (p_isActive.boolValue)
                    map.Enable();
                else
                    map.Disable();
                dirty = true;
            }
quaint zephyr
#

Figured it out! So the issue was that it was updating correctly, however when I called serializedObject.Update BEFORE ApplyModifiedProperties(), it would retrieve the serialized state and overwrite the managed side. So I misunderstood the purpose of those two methods. Turns out Update will overwrite the managed state with whatever values are currently stored in the serialized version, and Apply will persist whatever values are in the current managed state overwriting the serialized state.

quaint zephyr
#

Ok. New question. I don't really know how to even search for this online. I am using NaughtyAttributes plugin, which has a BoxGroup("GroupA") attribute for a property. How would I keep it's current behavior if I overwrote a class with my own custom editor script? Or does this mean I have to write that behavior myself as well?

Is there a way to 'pass through' existing attribute behavior through my custom editor script without having to reinvent the wheel?

waxen sandal
#

Depends on the implementation of NaughtyAttributes

#

There's probably something that you can inherit from that'll have the base behaviour for those groups

odd palm
onyx harness
barren moat
#

Is there any easy error dialogue function in Unity?

#

Something like JS's window.alert

onyx harness
#

Like?

#

Yes

barren moat
#

Just for editor

barren moat
#

Thanks @onyx harness

#

"Acceept" hehe

quaint zephyr
onyx harness
#

I mean.... it was right or wrong depending on what you were doing

quaint zephyr
#

Yeah I figured. It was because of my miscommunication. And I commend you for admitting mistakes. I have great respect for people like that. 🙂

near jewel
#

Any idea about how to make my struct drawed ?

#
    [Serializable]
    public struct AABB
    {
        public int X;
        public int Y;
        public int Width;
        public int Height;
    }```
#

the struct itself

quaint zephyr
#

Are you trying to “overwrite” unity’s AABB struct?

near jewel
#

Yes I am

#

In my code, it is totally fine, c# understand that he need to use my overwritten version

#

but unity editor don't, and he then draw the original AABB struct

quaint zephyr
#

Now, please correct me if I’m wrong, but the unity editor is not reading the struct directly, it is reading the Custom Property Drawer that is referencing the Type AABB. I think you should play around with that and see if it will affect the struct in the inspector.

near jewel
#

Haha maybe I should have mentionned that I am not really familiar with how the unity editor handle drawing

#

If I understood what you said, the editor see that my struct is called "AABB", so it draw the properties of the AABB struct it know, which in my case is not the right one ?

#

Is it possible to "overwrite" the Custom Property Drawer like you said ?

quaint zephyr
#

Yes it is. That’s what that’s there for. Type in unity custom property drawer in google and you’ll get the api description.

#

There is a little more to it though, you’d have to learn a little about editor customization, it’s not as straightforward was the player monobehavior code structure. But once you grasp it, it’s very simple.

near jewel
#

Ok, so I need to create a CustomEditor ?

#

Fine, I had plan to create one anyway, to learn how CustomEditor work ^^

#

Thanks for the help !

quaint zephyr
#

No. I don’t think you will need custom editor. Custom editor is for customizing the entire component in inspector. You’re just looking to customize the property. If you use custom property drawer, then that property will be drawn your way across ALL components, custom or standard. Does that make sense?

near jewel
#

Oh I see, i just went to the doc and I guess it's now clear in my mind

waxen sandal
#

It'll draw for all properties of that type

#

I've never heard of a property drawing rendering UI for a type with the same name

onyx harness
waxen sandal
#

^

#

Anyways, without more context it's hard to know what's going on in your case @near jewel

onyx harness
#

Unity sometimes lookup for string instead of Type. It happened once for an attribute, I saw that.

#

But you're right, I don't remember them doing it for PDrawer

near jewel
#

Here is how my struct is drawed in the editor

waxen sandal
#

What's probably happening is that your Hitbox field type is resolving to Mathematics.AABB rather than your AABB

quaint zephyr
#

There you go, now the experts come out 😛 sorry if I mislead you.

near jewel
waxen sandal
#

No, you need to make the type of your field your type rather than the mathematics type

onyx harness
#

Give it a simple test workaround, just renamed it AABBC

near jewel
onyx harness
#

Ok

near jewel
waxen sandal
#

Easy way is to remove the unity.mathematics using

#

The slightly harder way is to do namespace.aabb in the field type definition

near jewel
#

The AABB already have a namespace, even when it is precised, unity editor still draw the wrong "AABB"

waxen sandal
#

Can you post the code to the entity script?

near jewel
#
namespace Physic
{
    public class Entity : MonoBehaviour
    {
        // [HITBOX] \\
        public AAB hitbox;
        public AAB WorldHitbox => hitbox + transform.position; // Represent the hitbox relative to the position

        // [COLLISION] \\
        public bool Collidable; // Can we collide ?

        protected bool IntersectWith (Entity other, Vector2Int offset)
        {
            return other.Collidable && (WorldHitbox + offset).Intersects(other.WorldHitbox);
        }

        protected bool IntersectWithAny<T> (Vector2Int offset) where T : Entity
        {
            return EntityLister.instance.physicEntity.Any(_entity => IntersectWith(_entity, offset));
        }

        private void OnDrawGizmos ()
        {
            Gizmos.DrawWireCube(transform.position + new Vector3(hitbox.X, hitbox.Y), new Vector3(hitbox.Width, hitbox.Height));
        }
    }

    [Serializable]
    public struct AAB
    {
        public int X;
        public int Y;
        public int Width;
        public int Height;
    
        public AAB (int x, int y, int width, int height)
        {
            X = x;
            Y = y;
            Width = width;
            Height = height;
        }

        public bool Intersects (AAB rect)
        {
            //return (X + Width) > rect.X && (rect.X + rect.Width) > X && (Y + Height) > rect.Y &&
            //       (rect.Y + rect.Height) > Y;
            
            return  (Mathf.Abs(X - rect.X) < (Width + rect.Width)) && 
                    (Mathf.Abs(Y - rect.Y) < (Height + rect.Height))   ;
        }

        public static AAB operator + (AAB a, Vector2 b)
        {
            return new AAB(a.X + (int)b.x, a.Y + (int)b.y, a.Width, a.Height);
        }
    }
}```
#

I renamed it to AAB to make it usable

waxen sandal
#

What about the usings?

onyx harness
#

No need for using

#

I got this behaviour on Unity 2018.4

#

Any struct named AABB will be drawn like that

#

The fields inside don't even matter

near jewel
#
using System.Linq;
using UnityEngine;
#

Ah, glad to see I am not the only one

#

Have you managed to fix this problem ?

onyx harness
#

Unfortunately it seems to be a bug in Unity side

#

I suspect propertyType returns Bounds for any fields named "AABB"

near jewel
#

So actually the only solution now is to make a custom property drawer ?

onyx harness
#

As a fix, just rename your struct and remember to not use a name used by Unity.

#

CP won't bring you much except having the name AABB

near jewel
#

Yeah right, thanks for the help and answers everyone :)

reef lance
#

At some point it DID randomly change to left shift though, after it showed joystick7 before. I'm very confused how that happened, and why it doesn't happen now.

somber zinc
#

How come I cannot access public properties on my ScriptableObject?

public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        AttackSO attackSO = (AttackSO)target;

        GUILayout.Label("Does this attack depend on direction?");
        target.directional 
    }
public class AttackSO : ScriptableObject
{
    public bool directional = false;
#

directional doesn't exist on target

#

in a custom editor script

quaint zephyr
#

You can't use target.directional

#

because target is a UnityEngine.Object class lol

somber zinc
#

I thought I casted it

quaint zephyr
#

Instead use attackSO.directional

somber zinc
#

ohhh

#

Yeah

#

So am I limited to the field they provide? Can I not show fields for classes that isn't default unity like ClipState.Transition

quaint zephyr
#

You are not limited. If they don't have (by default) what you are looking for, you can create your own. That is the whole point of customizing editor.

somber zinc
#

Oh well I just want to make a simple show these if this bool is on, and these classes already have stuff that they do when they are serialized

#

I just want to equivalent of what it looks like when you would normally serialize them but just wrap it in an if statement so they don't always appear

quaint zephyr
#
OnInspectorGUI()
{
  bool serialziedObject.FindProperty("conditionalToggle").boolValue = EditorGUILayout.Toggle(serializedObject.FindProperty("conditionalToggle").boolValue);

  if (conditionalToggle) {
    // draw the stuff you want shown here
  }
  // otherwise they will NOT appear
}

something like this?

somber zinc
#

Yes, except the opposite, I have the bool field, I just want to draw the properties if that bool field is true

quaint zephyr
#

Someone help me out here, am I not understanding this guy correctly or what?

somber zinc
#

I want to know how to display these

#

on my scriptable object

#

in an editor script

#

I only know how to display stuff like GUILayout.Label, button ect.

quaint zephyr
#

Have you tried EditorGUILayout.ObjectField ?

somber zinc
#

no but that's probably it, I assume serialized property is found using FindProperty?

quaint zephyr
#

Yes.

#

Oh you want the ObjectField to be constricted ONLY to ClipState.Transition objects?

somber zinc
#

I'm not sure, I just want to draw them, I got close too but the drawing doesn't look like what it does when you serialize them

quaint zephyr
#

Canyou give a more specific example of what you mean by "draw" them?

somber zinc
#

This is how they show up when you put [SerializeField] next to them in a normal script

#

I just want to be able to show that in my editor script

quaint zephyr
#

Then you probably need to look at Custom Property Drawers

brittle acorn
#

Could anyone point me to the API docs for interacting with menus in the top-level ribbon? (File, Edit, Assets, etc.)

quaint zephyr
#

Sorry, maybe not. I think that the component it's showing up as has a custom editor that shows it that way.

#

It's simply a foldout with floats and bool fields

somber zinc
#

I think I've found the property drawer I need, I'm just not sure how to use it
https://kybernetik.com.au/animancer/api/Animancer.Editor/TransitionDrawer/

#

I wish there was just an easy function that was like DrawThisLikeInInspector(Property);

#

lol

quaint zephyr
#

You know, that's a great question. Don't settle on my answer, I'm a n00b compared to some experts here (cough @onyx harness cough @mellow oar cough @waxen sandal). So you are trying to write a custom editor but draw an existing property drawer without having to "redraw" it yourself. If you figure this one out, please do let me know, I would sure like to know the answer to this one meself 😉

waxen sandal
#

Call the base method?

#

Oh editor, there's this draw default gui method iirc

somber zinc
#

Doesn't that draw everything though right?

onyx harness
#

@brittle acorn UnityEditor.Menu

onyx harness
mellow oar
onyx harness
#

DrawPropertiesExcluding

mellow oar
#

@onyx harness has a better answer than I

#

How much do you want to have custom inspectors?

somber zinc
#

pressing bool to show more options is fancy

mellow oar
quaint zephyr
#

Oh wow, When did they introduce DrawPropertiesExcluding method? That is extremely powerful! @onyx harness

somber zinc
#

It's so convoluted, maybe it's just inexperience but it's so weird how you cannot just draw a single property like it's shown normally with one function and not an array of every other property

brittle acorn
#

@onyx harness thanks!

#

docs look pretty sparse, but if that's what we got

mellow oar
somber zinc
#

Only reason I didn't buy Odin Inspector this sale is because I saw a tut on UnityEditor basics and I was like "Surely this won't be a weird as hell system and just let me do what I want simply"

quaint zephyr
#

lol I failed hhaha

brittle acorn
#

❤️ odin

mellow oar
#

Anytime you're operating outside of Monobehavior, you're going to be burning brain cells on things you swear should be simple. Llike shivers arrays.....

#

Arrays should not NEARLY be so blooming difficult to show in a custom inspector. But they are....

brittle acorn
#

speaking of simple things, is there an easy way to assign a keyboard shortcut to just open the Asset menu?

mellow oar
#

You mean the asset store? Because that's Ctrl+9

onyx harness
#

catlikecoding editor tutorials are a bit old, but still do the job

brittle acorn
#

eg. I'd like to be able to create a new shader without having to touch my mouse, but also without assigning 5 separate hotkeys to surface/unlit/image effect etc.

brittle acorn
#

I assume I'm grossly overlooking something because it seems like a pretty common use-case

brittle acorn
#

^ that was it

somber zinc
#

I think I'll just abandon fancy bool expanding

mellow oar
#

OH you mean the toolbar "Asset" menu. I'm a dunce.

waxen sandal
#

There's also that plugin from Unity that lets you search for actions/assets

#

I forgot what it's called

somber zinc
#

I think naughty attributes has a showif attribute

#

Might try that

mellow oar
#

Odin Inspector has a Show If attribute too

onyx harness
#

QuickSearch?

mellow oar
#

ALL HAIL ODIN!!!!

somber zinc
#

I know but I already spend like 70 eur on asset store

mellow oar
#

Okay I'll quit being annoying

somber zinc
#

cannot get Odin

mellow oar
#

awww.

waxen sandal
#

Odin isn't that great imo

brittle acorn
#

thanks again @onyx harness

mellow oar
#

lol

brittle acorn
#

their discord is also pretty good

#

devs are active

mellow oar
#

It will always have a warm place in my heart. But I do not discriminate! What do you prefer? And yes the devs are SUPER active in the Odin Discord

onyx harness
waxen sandal
#

Odin is great for people that don't want to do editor scripting

#

Which I'm not

#

I love doing editor scripting

onyx harness
#

Before a mod comes here, @mellow oar I have to tell you that meme are not authorized here (not my choice :))

mellow oar
#

I switch between the two as needed. I just find Odin saves me time. It's the difference between writing maybe two or three attributes in a single script versus having a whole new script with 30+ ;ines of code

mellow oar
brittle acorn
#

It's almost a double-edged sword

mellow oar
#

I want to know why the murdered the memes though.

brittle acorn
#

You realize you can do all this cool stuff "easily" and then you've spent the entire day prettying up your editor and done nothing on your actual product

mellow oar
brittle acorn
#

for sure, that's adding real value

quaint zephyr
#

If you don’t want to spend money on plugin, you can use NaughtyAttributes plugin. I use it all the time.

brittle acorn
#

but if you're just a solo dev and no one is ever going to see this but you

#

hypothetically...

waxen sandal
#

Uhu

#

Doesn't mean you can't have good tools

brittle acorn
#

true

mellow oar
#

Okay maybe a little customization here or there. Actually.

#

But not like I do at work

onyx harness
waxen sandal
#

Ads keep getting more intrusive 😛 /s

onyx harness
#

I knew you would be around XD

#

Well, as long as it is free 🙂

waxen sandal
#

Yeah for sure, you actually do good work

onyx harness
waxen sandal
#

Saw it in slack yeah

mellow oar
waxen sandal
#

Nope

#

Mikilo is

mellow oar
#

Oh snap!

#

And I can't even throw in a meme showing Wayne and Garth bowing down to you @onyx harness

onyx harness
#

No worry, it's all received 🙂

waxen sandal
#

You know, I tried your api versioner before and somehow I couldn't figure out how to use it. I must be a big dummy

#

works perfectly now though

waxen sandal
#

@visual stag ^

mellow oar
#

n00b question that I probably should be embarassed to ask for but. What do you mean API versioner?

waxen sandal
#

It shows which API is available in which versions

onyx harness
# waxen sandal works perfectly now though

Because I implemented lookup for Type/Member later. It became more intuitive at this point. Before that, you had to type in the Type then the Member, not much more difficult, but less intuitive nevertheless

waxen sandal
#

Ah might've been it, thanks

onyx harness
somber zinc
#

EditorGUILayout.PropertyField(serializedObject.FindProperty("attackAnim"),true);

#

You just put true there

#

and it draws children

quaint zephyr
#

Wow I did not know about PropertyField. Thanks for the info! Glad you shared that with me!

whole steppe
#

how do I have optional dependencies?

#

i'm working on a package that i want to integrate with a dependency but only if it's available

#

and i don't want the using definition blowing up those that don't

#

i'm trying to use CCU

#

but doesn't seem to work

violet wraith
#

Hi!! I am using a ReorderableList to show and edit a list of objects (represented by a serializable class)... one of the properties of the objects is a scriptableobject... the list shows everything all right, i can add, remove, reorder without problems.. but the scriptableobject property doesn't work fine, I can drag assets of that type into the field but when I show the object picker and select the asset there nothing works... anyone aware of this problem?

#

thanks in advance!!

#

If I disable the editor and use standard list in inspector, the object picker works just fine

steep delta
#

Is it possible to show a list of components that can be added adjacent to the selected element (2D)? Like in flowchart editors, draw.io etc.

So you put an element and click on arrows or whatever on its' sides and it will show some list of elements that can be added here. I know how to create an element on scene via extension, but not sure if it is possible to show such menu. Is there any extensions doing something similar?

waxen sandal
#

Or an editor window that's styled as a menu

#

@violet wraith Need to see some code

violet wraith
#
        private void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
        {
            SerializedProperty deckEntry = _reorderableList.serializedProperty.GetArrayElementAtIndex(index);
            rect.y += 2;

            SerializedProperty amount = deckEntry.FindPropertyRelative("amount");
            SerializedProperty card = deckEntry.FindPropertyRelative("card");
            
            string title = (card.objectReferenceValue == null) ? "Nueva carta" : card.objectReferenceValue.name;
            
            EditorGUI.ObjectField(position:
                new Rect(rect.x += 1, rect.y, Screen.width * .8f, height: EditorGUIUtility.singleLineHeight), property:
                card, typeof(Card), label: new GUIContent(title));
        }
#

Cant be more simple, there is where I render my scriptable object (Card)

#

"render my list elements" sorry, the scriptable object is the Object field

waxen sandal
#

ObjectField returns the new value

#

So you need to assign it to your property

violet wraith
#

good... i will try that

#

let you know if it works... thanks!!!

#

mmm card it's a serializedproperty, it looks that Editor.ObjectField returns void

burnt dove
#

How can I have a free move handle which also track when it's clicked? Using Handles.FreeMoveHandle + Handles.Button doens't work (because one handle is build on top of the other hidding it from the screen)

violet wraith
#

Anyway thanks!!!

onyx harness
somber zinc
#

That's what I was asking though

#

also should I cache the findproperty?

onyx harness
#

Of course in your case it works well, but the Excluding is made when you want to handle all but one (I know what I'm writing is obvious)

#

Yes

#

Can you remind me why DrawDefault does not work?

somber zinc
#

Because I don't want to draw everything, and making an array with every other property makes no sense when you can just do this

real meadow
#

Should not be capturing when there is a hotcontrol
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Keep getting this and Google have been unhelpful. It happens when I try to expand my custom component. I'm trying to use inheritance with Unity Editors. But I want to hide away the Camera component that I need completely so it can only be access programmatically. This is because I wanted to originally extend the Camera class, but I can't do that because it's sealed =_=

So this is my abstract class. It just holds all editable fields on a standard Unity Camera. It's my way of getting around the "hide in editor" part.

public abstract class SeeThruInspector : Editor
{
...
public override void OnInspectorGUI()
{

And then I make an editor which can edit the fields of my own code only. This way I can make many different cameras and have them all use the same base editor, because they will all have the same base camera properties...

[CustomEditor(typeof(FreeFlyCamera))]
[CanEditMultipleObjects]
public class FreeFlyCameraInspector : SeeThruInspector
{
...
public override void OnInspectorGUI()
{
    base.OnInspectorGUI();
...
    serializedObject.ApplyModifiedProperties();
...

What could be the issue?

onyx harness
#

To hide a Component, wouldn't you just need to set the hideFlags?

real meadow
#

I am already successfully hiding the camera

#

But the issue is that I also want to be able to still edit it via the inspector

#

So what I came up with was just to make an abstract class that holds all the values a camera normally has exposed in the unity editor

#

Then make a component that extends it

#

This works great, but it doesn't hide the actual camera component in the editor

#

So to get around this, I'd have to do the custom inspector stuff

onyx harness
#

Sorry I think I don't understand

real meadow
#

aight

#

I'll start from the top

onyx harness
#

Can't hiding the Component Camera done via hideFlags?

#

but it doesn't hide the actual camera component in the editor
Based on that ^

real meadow
#

I want to make cameras in unity. A package of different ones like FPS camera, free fly camera, etc.
But I also want it to feel native to Unity. So to do this I'd just extend the Camera component right?
Well I can't do that, because the camera class is sealed. So what's the alternative?
Well the alternative is to hide away the camera component via a custom editor. That should be easy enough right? It is! But the issue is then that I still need to be able to edit the cameras values.

I can't do that since the camera is hidden...so what do? My solution is to simply copy every single field that you can edit on a camera over on my new component, then apply the changes you make to that component in the editor to the hidden camera.

#

But I run into issues because when I try to change my component values nothing actually changes.

#

I just get that error all the time

#

Should not be capturing when there is a hotcontrol
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

split bridge
#

Hiding existing settings is exactly what I don't want from a tool. I would recommend against it. Instead, design through composition. Leave the camera as is, add an 'FPS Camera component' that has a nice editor and settings imo.

#

Bigger picture, if this is for other users you may want to think about working with cinemachine as that's what a lot of people use.

real meadow
#

The camera component is just hidden in the inspector

split bridge
#

I wouldn't want a script that extends Camera.

real meadow
#

Why not?

split bridge
#

because I prefer design through composition - the way the rest of Unity works

real meadow
#

It's very cluttered

split bridge
real meadow
#

That does not remove anything

#

It just makes it not used by Unity

split bridge
#

? I'm talking about the arrow you can use to collapse a component

real meadow
#

Hm okay

#

I want the Cameras I make here to feel native to Unity, rather than some addon thing.

somber zinc
#

Isn't that how unity's camera looks

#

it's very long

split bridge
#

what have you seen that's native to Unity that hides existing stuff? Check out cinemachine if you haven't already.

real meadow
#

Shapes by Freya

#

For one

#

A lot of stuff happens behind the scene when you use those

#

It's a completely legitimate thing to want for editor extensions

#

Or rather

#

Let me rephrase

#

Shapes feels native to Unity

somber zinc
#

Oh do you want a collapsible header for unity camera

real meadow
#

Exactly because a lot of the stuff you don't have to worry about as a user is hidden away

real meadow
#

I don't

#

I want it to not be seen in the inspector

somber zinc
#

just none of it?

real meadow
#

Yep.

#

I can't extend the camera component

#

So this is the nextbest thing

somber zinc
#

I remember someone showed me something, and you can do Editor.show or whatever but specify an array to not show

split bridge
#

If you really want to duplicate every important setting in the cameras.. go for it. Sounds like a terrible idea to me personally. Because every setting is important. Especially given the variation between the pipelines and forward/deferred etc.

real meadow
#

Well that would just be part of doing this really.

#

I appreciate that you mention these other things Timboc, but I'd like to try and find a solution to what I am trying to do 🙂

split bridge
#

Custom tools are important. Keeping things uncluttered is great. Hiding existing settings/functionality I'm really not a fan of.

real meadow
#

I think you misunderstand then

#

Because the original functionality is not gone

#

It's simply put on my component while hiding the camera

#

The user experience is going to be the same.

#

You can even drop the component into Camera spots

#

If you needed to

split bridge
#

If you duplicate all existing functionality... why not just leave the Camera component and use composition to add the additional customisation you want.

real meadow
#

Because it's cluttered 🙃

split bridge
#

how is it more cluttered if you duplicate all the settings? It's less cluttered because you can separately collapse the normal camera settings?

real meadow
#

One thing I dislike about Unity's composition approach is that the ordering of things is completely arbitrary and unless you enforce it yourself will end up having a bunch of components all over your gameobjects in no orderly fashion whatsoever.
To lessen the burden of using these more specialised cameras I want to hide away the Camera component that Unity doesn't let me extend.

#

So from a user perspective it will be just like using the camera you are used to + extra fields for customisation

#

👍

#

I mean if I wanted to I could probably just make groups in the inspector and then that would be that no?

paper orbit
#

Hi! how can i show a property on the editor?

 public bool selfShadows
        {
            set { m_SelfShadows = value; }
            get { return m_SelfShadows; }
        }

i know i can use a field, but i have to do something when this property changes

real meadow
#

So given the below, the actual camera does get hidden from the inspector. Problem is, I can't actually edit my own component. I just keep getting the same error that I posted originally.

Should not be capturing when there is a hotcontrol
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

public virtual void OnEnable()
{
    Camera target = serializedObject.targetObject as Camera;
    target.hideFlags |= HideFlags.HideInInspector;
}
public virtual void OnDisable()
{
    Camera target = serializedObject.targetObject as Camera;
    target.hideFlags &= ~HideFlags.HideInInspector;
}
#

@paper orbit I think GUILayout.BeginChangeCheck() should help with that

onyx harness
real meadow
#

Okay, then ask for more code if that's the issue 🙂

onyx harness
#

Go on

real meadow
#

What would you like to see then?

#

The abstract inspector?
The inspector extending it?

#

The component I try to make the inspector for?
The abstract component it extends?

#

There is just quite a bit of code here so I didn't want to bombard the chat

onyx harness
#

I guess the nature of the bug and perhaps the entire Editor code?
By nature, when you stated "all the time", it needs clarification

#

Because I read "every frame", but is it?

#

Or maybe it's on a click? When you unfold? Open a popup? (Like color picker)

real meadow
#

When I click the component to expand it or when I click any field in the editor for that component

#

I get the error

onyx harness
#

Does it happen on a key down?

real meadow
#

It's not every frame it's just every time I click anywhere on the component itself in the editor or try to expand/shrink it

#

No, nothing triggers on key down

spark lotus
#

It's your clicking that's causing the error..

onyx harness
#

What other Component do you have on the GameObject?

real meadow
#

Just the Camera

#

@spark lotus I know

spark lotus
#

You've got some kind of custom editor that relies on mouse event but are modifying it before other scripts can properly address the event.

onyx harness
#

Show us some Editor code, might ring a bell

real meadow
#

Alright, give me a sec

spark lotus
#

That's why you're receiving the hot control error

burnt dove
#

Any idea how can I fix that (see picture below)? Fields are not auto-resizing to fit the screen.
I'm using:

try
{
    Handles.BeginGUI();
    GUILayout.BeginArea(new Rect(0, 0, 300, EditorGUIUtility.currentViewWidth));
    EditorGUI.BeginChangeCheck();
    EditorGUILayout.BeginVertical(GUI.skin.box);
    // [...]
    EditorGUILayout.LabelField(OBJECT_CONTENT, OBJECT_LABEL);
    // [...]
    EditorGUILayout.LabelField(PATH_CONTENT, PROPERTY_PATH_LABEL);
    // [...]
    EditorGUILayout.LabelField(PROPERTY_CONTENT, PROPERTY_NAME_LABEL);
    // [...]
    EditorGUILayout.PropertyField(selected.serializedProperty, RELATIVE_POSITION_CONTENT);
    // [...]
    absolutePosition = EditorGUILayout.Vector3Field(ABSOLUTE_POSITION_CONTENT, absolutePosition);
    // [...]
    EditorGUILayout.Vector3Field(REFERENCE_POSITION_CONTENT, reference);
    // [...]
    if (GUILayout.Button(CLOSE_BUTTON))
        // [...]
}
finally
{
    EditorGUILayout.EndVertical();
    if (EditorGUI.EndChangeCheck() && selected != default)
        selected.serializedProperty.serializedObject.ApplyModifiedProperties();        
    GUILayout.EndArea();
    Handles.EndGUI();
}
real meadow
#

I could understand as much from goolgeing as well but I couldn't find any kind of solution to it

onyx harness
real meadow
#

Here is the Abstract Editor - SeeThruInspector: https://pastebin.com/fyaJwqCA
Here is the Extending Editor - FreeFlyCameraInspector: https://pastebin.com/CFuAFLKy

SeeThruCamera is the component I made to hold all the Camera fields. The FlyFreeCamera is one that extends it to add all the extra fields that I want. If you need those too let me know.

burnt dove
onyx harness
#

Nope, keep BeginArea

#

ChangeCheck is a one time operation.

real meadow
#

Which means

onyx harness
#

(It is not related to your issue above)

real meadow
#

Okay

#

I'll refactor that part of the code, so thanks for pointing it out

burnt dove
#

GUIOption doesn't exist 😦

onyx harness
#

Meaning when UseAxis changes, it will draw your Horizontal/VerticalMoveAxis but, just for one frame

#

@burnt dove GUILayout.Width

#

@real meadow Reduce your code to one single PropertyField. And uncomment one by one, until you find the culprit

real meadow
#

Okay will try that @onyx harness

burnt dove
#

I wasn't able to fix that with GUILayout.Width, thought removing EditorGUILayout.BeginVertical did fix it... but now I don't know how to the background color to gray (previously I was passing GUI.skin.box to that method) 😦

onyx harness
#

@burnt dove If you just want to draw a background, just use GUI.skin.box.Draw() (on event Repaint only!)

burnt dove
#

Ok, I'll try

real meadow
#

It doesn't seem to matter what I do @onyx harness .
The error keeps popping up

onyx harness
#

empty one?

real meadow
#

I guess I can't really do abstract editor windows :/

#

yea

burnt dove
#

It works @onyx harness, thanks!

onyx harness
#

@real meadow Have you think about drawing Camera's Editor directly into your Editor?

real meadow
#

Í have.

#

But I wouldn't know how to go about that

onyx harness
#

Have you try?

#

Editor.CreateEditor()?

real meadow
#

I have tried that yes, but that's a lot more cumbersome than an inspector isn't it?

onyx harness
#

Well, i feel it is way quicker than your way

#

You just get the Editor, and call DrawDefaultInspector().

#

you won't want the default? You call DrawPropertiesExcluding().

#

When you started to talk about overriding Camera, I thought you did that

#

And then I saw your code and saw several FindProperty and their PropertyField

#

Much less sustainable in the long term

real meadow
#

So I just discovered something

#

No matter what I do, the hot control error pops up

#

I just made an inspector that only hides the camera and nothing else. There is no inheritance used here.

onyx harness
#

What about unhidding the Camera?

real meadow
#

Component

[RequireComponent(typeof(Camera))]
public class FooCamera : MonoBehaviour
{

}

Inspector

[CustomEditor(typeof(FooCamera))]
public class FooCameraInspector : Editor
{
    FooCamera self;
    public void OnEnable()
    {
        self = serializedObject.targetObject as FooCamera;
        self.GetComponent<Camera>().hideFlags |= HideFlags.HideInInspector;
    }

    public void OnDisable()
    {
        self.GetComponent<Camera>().hideFlags &= ~HideFlags.HideInInspector;
    }

    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        serializedObject.ApplyModifiedProperties();
    }
}
#

This does not work. It gives you the error I pointed out

#

So I have a suspicion that this is a Unity bug.

onyx harness
#

Even with OnInspectorGUI totally empty?

real meadow
#

yep

onyx harness
#

and what about removing the Hideflags?

#

Perhaps Inspector didnt liked it

real meadow
#

Then it works. I can expand and minimise the components

#

But of course

#

Now the camera is not hidden anymore

onyx harness
#

There are other solution

#

Like directly removing/hidding the Component Camera from Inspector via UI Element.

real meadow
#

Not sure what you mean

onyx harness
#

The same way, you can remove/hide (opacity: 0, or height: 0)

real meadow
#

So Instead of hiding the camera component with hideflags, it would be hidden by changing the components header opacity to 0?

onyx harness
#

yep

#

Opacity is kinda dangerous, prefer height

real meadow
#

Right,

#

I imagine you can still expand an invisible component

onyx harness
#

Because opacity just hide it visually, but the area is still taken

real meadow
#

Hm okay. I guess that could be an alternative at least.

onyx harness
#

Well, if it is not visually clickable, perhaps not

real meadow
#

Not a super destructive way either so, that's nice.

onyx harness
#

yep

real meadow
#

How would I do that?

onyx harness
#

hahaha

#

Learn how to use UI Toolkit (new name for UI Element)

real meadow
#

Ah..

onyx harness
#

Q() is your best friend

real meadow
#

Wel

#

Q()?

onyx harness
#

Use the UI Toolkit Debugger

#

Q() is the equivalent method of FindProperty() if you like

real meadow
#

So instead of FindProperty() you just write Q(...) ?

onyx harness
#

Like jQuery $()

real meadow
#

Right

onyx harness
#

Kinda

#

UI Tookit is like HTML/CSS stuff

real meadow
#

$ is the jQuery scope.

onyx harness
#

use the debugger

#

Q() works similarly

real meadow
#

But even if that is an alternative to do this, it would still seem that I found a Unity bug which is easy to reproduce.

#

But thank you for the help @onyx harness

#

It didn't have a satisfying ending, but at least I know that I'm not insane now

#

It really does seem to be a Unity bug

naive canopy
#

I was this was the place to go for my issue... For some reason my Int[] on my scriptableobject keeps getting reset

waxen sandal
#

Got a custom editor?

naive canopy
#

yeah

waxen sandal
#

Show code

naive canopy
#

I'm using ProtoTile protoTile = (ProtoTile)target;

#

I don't have any attributes on the scriptableobject

waxen sandal
#

It's best to use serializedproperties

stark geyser
naive canopy
#

hatebin? ok

#

So that's likely the source of my issue?

waxen sandal
#

Not using serializedproperties?

naive canopy
#

yeah

#

I know it does save.. most of the time

#

or is it because I'm not using serializedproperties whatever it's doing is.. unstable?

waxen sandal
#

Your data is sometimes getting saved as a side effect of something else in the editor happening

naive canopy
#

because when I look into the asset file it's just a long series of non binary numbers

#

oh, so it's not supposed to work lol

#

ok, I'll switch it over and see what it looks like

waxen sandal
#

In editor you shouldn't directly modify an object

naive canopy
#

I see

#

before I go and do that, I have one more issue

#

Wait, would questions about the AssetPostProcessor go here too?

#

Or is there another channel that might be a better pick

waxen sandal
#

Yes, here is fine

naive canopy
#

So I have this asset post processor

#

you reimport a sprite sheet, it slices it, then creates a scriptable object

#

you can ignore the scriptableobject creation bit, the issue is with the sprites

#

textureImport.spritesheet = metaList.ToArray() throws an exception every time

#

yet it still works

#

let me snag the exception

#

InvalidOperationException: Sequence contains no matching element
System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] predicate) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
UnityEditor.U2D.Animation.SpritePostProcess.PostProcessBoneData (UnityEditor.U2D.Sprites.ISpriteEditorDataProvider spriteDataProvider, System.Single definitionScale, UnityEngine.Sprite[] sprites) (at Library/PackageCache/com.unity.2d.animation@4.2.6/Editor/SpritePostProcess.cs:107)
UnityEditor.U2D.Animation.SpritePostProcess.OnPostprocessSprites (UnityEngine.Texture2D texture, UnityEngine.Sprite[] sprites) (at Library/PackageCache/com.unity.2d.animation@4.2.6/Editor/SpritePostProcess.cs:29)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
UnityEditor.AssetPostprocessingInternal.InvokeMethodIfAvailable (System.Object target, System.String methodName, System.Object[] args) (at <20b79eb59c0f467d8b1106b2110bc953>:0)
UnityEditor.AssetPostprocessingInternal.CallPostProcessMethods (System.String methodName, System.Object[] args) (at <20b79eb59c0f467d8b1106b2110bc953>:0)
UnityEditor.AssetPostprocessingInternal.PostprocessSprites (UnityEngine.Texture2D tex, System.String pathName, UnityEngine.Sprite[] sprites) (at <20b79eb59c0f467d8b1106b2110bc953>:0)

#

there is something in the internal part of unity that doesn't like that metalist

waxen sandal
#

Is textureImporter.spritesheet empty maybe?

naive canopy
#

it shouldn't be... (TextureImporter)assetImporter should provide a reference

#

let me check in debug real quick

waxen sandal
#

You should really just open the source code of that package and see what it's doing at that line

#

It's expecting some data in an array/list but there isn't any

naive canopy
#

the array I'm providing it is valid. There must be some sort of optional data I'm not providing it

#

I need to see what the spriteDataProvider is, but it seems I can't lookup the definition

waxen sandal
#

Yeah that's why it's best to look at the source of SpritePostProcess:107

naive canopy
#

SpriteRect spriteRect = spriteDataProvider.GetSpriteRects().First(s => { return s.spriteID == guid; });

#

so I can see that spriteDataProvider has all of the sprites in an array

#

but I can't see the GetSpriteRects() method

waxen sandal
#

Sounds like you need to do something else with those sprite rects that you have

#

Not sure what though

naive canopy
#

if I look at the sprite rect's, they seem to be fine

#

no null values

waxen sandal
#

That class might be in the reference source on github

naive canopy
#

reference source?

waxen sandal
naive canopy
#

It's not there unfortunately, but that will be useful for later things

#

it looks like there is a guid mismatch somehow

#

the sprite array provided has guids that don't match the sprites in the ISpriteEditorDataProvider

#

maybe it has to do with the order at which I'm setting this up, I don't see anything I can feed a guid so maybe it's generating it's own because it's not defined somewhere

#

I'll pick that one back up later, at least I have a better idea of what avanue I need to fix it

#

now to implement that serializableproperty or whatever it was

#

Thanks @waxen sandal

quaint zephyr
#

If I want to make a Custom Property Drawer, is there a way to specify that if a component has it, that it is always drawn last (at the bottom) in the inspector? Or controlling the order of drawer display is something that can only be managed from Custom Editor?

onyx harness
#

Only from Editor

quaint zephyr
#

Dang. The reason I'm asking is because I am using NaughtyAttributes plugin, and they have an attribute called BoxGroup, and if you box group anything, it gets displayed at the end, where as without it, they are displayed in the middle (if they aren't last in the order). I thought that was cool, and thought if there was a way to do this without a custom editor script.

#

Oh maybe it's not an Property Drawer type deal, maybe I need some Attribute? If that is not something natively built in, could I make a custom attribute that can do that?

onyx harness
#

Custom Property Attribute to defer the drawing to the end?

quaint zephyr
#

Yeah. I mean how does NaughtyAttributes.BoxGroup get away with it?

onyx harness
#

I don't know, read the source you might extract some clues

quaint zephyr
#

TBH, I don't know where to start looking.

naive canopy
#

should I not be initializing my arrays on my class and instead initalize them in the CustomEditor?

#

that and I just don't understand how to use the serializedproperty

#

I've read a fair amount about it, but it's not clicking

onyx harness
#

lol

#

Please don't bring Odin in here, their features are nothing related to Inspector

#

It's like 2 different worlds

quaint zephyr
#

Oh really? They don't use custom drawers / editor?

onyx harness
#

And draw everything themselves

quaint zephyr
#

Oh wow. Ok

onyx harness
#

Therefore they have this power

quaint zephyr
#

I see...

#

🤔

onyx harness
#

to do things they want

#

But you can't state because they have it, Unity has it

quaint zephyr
#

Now I understand.

onyx harness
#

It can be true, but you would need to make your own Editor

quaint zephyr
#

lol too much work! haha

onyx harness
#

And then from there, you'll have the same amount of power as Odin

#

What Odin does is nothing extraordinary, but they did it well

quaint zephyr
#

Have to see if NaughtyAttributes did the same thing, but I have a feeling they didn't. I think they actually used Unity's drawers/editor scripts

slow gale
#

They didn't do the same as Odin, as far as I know. I could imagine ways for them to still control ordering, though.

quaint zephyr
#

Yeah if someone has any resources or advice on how I can go about property ordering without writing a custom editor for every component, I'd be thrilled to hear it 🙂

slow gale
#

You'd need to write a custom editor that is written in such a generic way that it could handle any component.

#

That's already what NaughtyAttributes does. And what Odin does, though our method of doing it is a bit different.

quaint zephyr
#

Hmm...well most of my components derive from UnityComponent which inherits from MB. UnityComponent is my own base class that I use that implements are more dynamic controlled debug logging that I can control on the fly. I have some other features I will be adding to it.

What you're saying is that if I want to do this, then I can write a custom editor for UnityComponent that can take care of that and draw everything else Default?

#

This is for that class actually, because it had debug toggles (bools) that I want displayed always at the bottom of any component that inherits from this class. So it doesn't interfere with the fields that the inheriting component will declare. Does that make sense?

slow gale
#

Yeah, that's possible to do. It would take a bunch of reflection and custom scripting though, depending on how you want to do it. And also if you want to still have something like NaughtyAttributes work.

#

But maybe there's a reason they haven't done it.

#

Not sure, to be honest.

#

Working within the Unity Way of doing things can be tedious in the most surprising ways.

quaint zephyr
slow gale
#

Well, yes, I found it so tedious that I wrote Odin after all 😄

quaint zephyr
onyx harness
#

Unity Inspector lacks of pretty much everything, in every direction, in every way, but it works

quaint zephyr
#

It would be a lot easier if there was a way I can like "forward" the NaughtyAttribute.BoxGroup into my custom editor without having to write the same behavior on top.

slow gale
#

Modifying the source code of the original is probably the easiest option.

quaint zephyr
#

I don't see how that will be a solution as when I CustomEditor it overrides all attributes over that particular component...no?

slow gale
#

Well, you'd modify the original to add ordering to it.

#

Or just ordering for your specific case.

quaint zephyr
#

Hmm... 🤔 Ok. I'll see what I can figure out. Thanks for the tip.

onyx harness
#

How come we talk about Odin and you suddenly appear like you were summoned?

quaint zephyr
#

lol

#

I thought that was perfect timing 🙂

#

I think they have supernatural dev powers

naive canopy
#

how do I use complex types like sprite as a serializedproperty?

#

I imagine I don't cast the resulting object do I?

slow gale
#

I lurk in several places, I just happened to come by right now 😄

#

@naive canopy That's exactly what you do, as far as I know.

naive canopy
#

like this?

#

SerializedProperty sprite = serializedObject.FindProperty("Sprite");
(sprite)sprite.objectReferenceValue

slow gale
#

Yes

naive canopy
#

ok that's all setup then

#

EditorGUILayout.EnumPopup((SocketTypes)sockets.GetArrayElementAtIndex(i).intValue);

#

it renders the enum correctly

#

but I can't change it

slow gale
#

Gotta get the new value back out of the method. It's the return value.

naive canopy
#

ohhh

quaint zephyr
#

Quickie: Does unity provide a GetSessionID in between each play mode sessions? Or is that something I'll need to cook up?

slow gale
#

Just something you can cook up, I think. But I might be wrong.

quaint zephyr
#

I think so too, it's easy, I just wanted to make sure I'm not reinventing the wheel.

onyx harness
#

Maybe you can look at Time

#

it might restart stuff to 0

#

Or hook to any event when the game stops

naive canopy
#

I used GetArrayElementAtIndex to get the value, but I don't see a way to do that for assignment...

quaint zephyr
#

No. I have this bug that I'm trying to track down. And apparently gameobject GetInstanceID persists over sessions. So I want a more unique way of identifying if that GO being references is from current session, or from last session. Getting NullReferences, I suspect it's because it's saving them somewhere in memory without wiping them when I exit play mode.

onyx harness
#

You got it wrong, you do GetArray then uses intValue, you need to reassign on intValue

naive canopy
#

wait... waht?

onyx harness
#

Oh InstanceId, this is a different topic, yes this one is unique for the lifetime of the Unity Editor Process

#

If you restart Unity, it might potentially have a new ID

quaint zephyr
#

Yeah I found out. I need an id that's unique for the lifetime of the play session 😛

slow gale
#

The EditorApplication.playModeChanged event (I think that was its name) probably makes it easier.

naive canopy
#

so I'm not on the right track with this line?

#

sockets.?????.intValue = Convert.ToInt32(EditorGUILayout.EnumPopup((SocketTypes)sockets.GetArrayElementAtIndex(i).intValue));

quaint zephyr
#

No, restarting unity will take forever for me to figure this out. I need something faster 😛

#

My GOs all inherit from UnityComponent, which stores some info for the debug logging. All I gotta do is implement this id and then I'll read in logs which GO is from which session.

naive canopy
#

do I need to do like var socket = sockets.GetArrayElementAtIndex(i)

#

and then just assign to that?

slow gale
#

Yes

naive canopy
#

Well that did it

#

I still find it confusing, but it's less confusing now

#

Thanks for the help

quaint zephyr
#

Or just have the custom logger generate those internally.

#

It's easy. I just wanted to see if something like that existed is all.

#

It's why I prefixed the question with Quickie:. Yes or no. 🙂

onyx harness
#

Just keep a counter in your logger class, increment it per start Play event and save the counter when you log your logs

#

You got it

naive canopy
#

Now all I have left is to hunt down the gross AssetPostProcessor bug

#

Mikilo/Tor, do either of you have experience slicing sprites in OnPostProcessTexture?

onyx harness
#

Nope

#

but a Sprite isnt "sliced" already?

quaint zephyr
#

Is it possible to display custom icons or emojis in the Debug Console?

onyx harness
#

Do you mean, slicing a Texture2D to get Sprites?

naive canopy
#

yes

#

from a spritesheet

onyx harness
robust mirage
#

Can I use the new UI Builder for editor extensions?

#

Anybody know?

onyx harness
#

Yes

robust mirage
#

oooo

onyx harness
#

But it is at your own peril

quaint zephyr
onyx harness
#

It's hardcoded

robust mirage
onyx harness
#

Flexibility, it has several features implemented. But it is so... it's an adventure to go there

#

@robust mirage If you go easy on it, probably you will like it

#

For advance stuff, you will google a lot

robust mirage
thin fossil
#

Is there any way to access additional mouse buttons in the editor?Input.GetKeyDown(KeyCode.Mouse3) works but (e.type == EventType.MouseDown && e.button == 3) does not 😕

quaint zephyr
#

@thin fossil What class is e? I don't think it stores button only for mouse. I think it's a generic that stores it for all possible buttons, so KeyCode.Mouse3 doesn't mean that it is int 3 as you are checking for with e.button.

onyx harness
#

@thin fossil Input and Event are 2 different systems

visual stag
#

I don't know how accurate that post is, but if you do log all the events in a Unity window you do get none for mouse 3 and 4

thin fossil
#

yeah I know they are 2 different systems. Thats the weird thing mousebuttons 3-5 work at runtime with Input.GetKey but they dont work in editor with Events

thin fossil
onyx harness
#

If you want to handle more than 3 buttons, use :

[DllImport("user32.dll")]
public static extern Int16        GetAsyncKeyState(Int32 virtualKeyCode);
#

Windows only obviously

thin fossil
onyx harness
#

Editor only

thin fossil
#

although I find it weird that unity does not recognize these buttons in edit mode as runtime can do it 😬

thin fossil
#

@onyx harness are there any constants for the return codes?

onyx harness
#

What does the doc say?

thin fossil
#

its just comparing like (GetAsyncKeyState(VK_ESCAPE) & 0x01

#

was wondering because it also returns another value while the button is down

onyx harness
#

This method should be called in Update

#

GetAsyncKeyState is more powerful than just Event.
It gives the state of down, up, hold of any key/mouse button.

thin fossil
#

just found the important part: "If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState"

obtuse bone
#

hey does anyone know a lot about Photon Pun 2? because I'm having problems

jade hollow
#

how can I set the selected editor object to an object within prefab mode?

simply setting Selection.objects to a reference to one of the prefab gameobjects does not work

if (GUILayout.Button("Add test object")) {

    using (EditPrefabContentsScope editingScope = new EditPrefabContentsScope(assetPath)) {
        GameObject root = editingScope.prefabContentsRoot;
        GameObject newObj = new GameObject("TEST");

        newObj.transform.SetParent(root.transform);
        Selection.objects = new Object[] {newObj};
    }

}```
quaint zephyr
#

@obtuse bone Photon PUN 2 is a networking plugin, not an editor extension plugin. Try your luck here #archived-networking

obtuse bone
#

ahh

whole steppe
#

how would i for instance grey out a certain field in the inspector ONLY if say a variable called "public bool Camera cam" is null? most-likely using reflection.

#

someone can help?

stone vector
#

Hello, friends. I'm writing a custom editor for a 2D map generator using Scriptable Objects for each biome type. Each biome will have a single TileBase for its background and a TileBase[] for its foreground. I am new to Editor scripting, but I know you can get the values for things like int, float, color, array, etc. However, there doesn't seem to be an option for anything to do with tiles that I can see. Using things like 'object' or 'reference' return an error as it can't cast to those types.

Could someone tag me and let me know what I should put here:

        obj = new SerializedObject(biomeData);

[...]

SerializedProperty bgTile = obj.FindProperty("backgroundTile");
        EditorGUILayout.PropertyField(bgTile, true);
        biomeData.backgroundTile = bgTile._____??```

'BiomeData' is the name of the SO class and 'biomeData' is the name of the target.
waxen sandal
#

There should already be a serializedobject for the target object

#

And to go into classes you can just find property and then findpropertyrelative on that instance

stone vector
#

If I don't reapply it and just do "FindProperty," I find that if I click off the object and go back, its Inpsector has reset and the changes made aren't stored.

split bridge
#

Is there an easy way to catch a GenericMenu having been cancelled/closed? nevermind - changed approach

waxen sandal
#

If TileBase is not a Unity Object then you have to use findpropertyrelative multiple times to find the "child" methods

stone vector
#

Yeah, I've been looking on Google and YT for hours. Could anyone tell me what I might pass in as an argument there? Like @waxen sandal said I'd have to use FindPropertyRelative, but what exactly am I passing in, since it's not a Game Object or child, it's just a tile.

waxen sandal
#

obj.FindProperty("backgroundTile").FindPropertyRelative("whatever fields TileBase has")

#

There's no api to get the class instance

#

Unless it's a unity object in which case it's objectreferencevalue

quaint zephyr
#

I made a wrapper class for Debug.Log, and it's working how I need. One thing I didn't foresee is the fact that when the log shows in console, the stack trace includes all the methods inside my wrapper class, which then prevents me from double clicking it and it going straight to the last item that called it, instead it will always go to the wrapper class.

Is there a way for me to exclude a class from the stack track when logging to console? Or I did a big no-no and should've made this in a different way?

#

🥴

onyx harness
#

You need a special console for that purpose

#

Most consoles in the Asset Store handles custom loggers

#

NG Console Free does it

split bridge
#

If you compile as a dll and include that instead of source, that’s one way @quaint zephyr. But as Mikilo says, this has been done many times before should you want an out of the box solution.

quaint zephyr
#

Thanks guys. I’ll look into it.

stone vector
#

Ok, so I think I found a work-around. Instead of using it with FindProperty, I simply did this:

biomeData.backgroundTile = (TileBase)EditorGUILayout.ObjectField("Background Tile: ", biomeData.backgroundTile, typeof(TileBase), false);

#

So far, that seems to work. 🙂

queen hull
#

Hello all. Does anyone know of any Visual Studio extensions that allow me to select multiple instances of a word ? ( Like CTRL + D in Visual Code )

waxen sandal
#

Should be supported out of the box afaik

#

You might have better luck in another channlel as this is not the correct one

queen hull
#

Oh, 😄

foggy birch
#

One message removed from a suspended account.

waxen sandal
#

@foggy birch thats a Web browser

foggy birch
#

One message removed from a suspended account.

real ivy
#

Im making extra fields show up when this value changes
It works, but if i open the little circle to select the object, the callback only triggers on the first time it's changed. How can it update everytime?

real ivy
#

As in, if i open the object selector via the small circle button, i have to select it once, then change my mind, gotta close the selector window, then select again. I cant just "change my mind" and select stuff in 1 selector window

onyx harness
#

But if you want rectangle GUI overlay, it is feasible in Unity Editor.

fossil gyro
#

Is it possible to "observe" certain textures? I want to execute a command when a certain texture (out of a list of textures (that is definied dynamically)) got changed from the outside or via the texture importer options.

#

it doesn't seem possible to use OnPreprocessTexture() / OnPostprocessTexture() for this, at least not reliably

whole steppe
#

someone can help?

#

so if i want to disable / re-enable the secondBool based on if the camera is null, how would i do that? right now, i have :

In the main directory :

MyGame.cs :

using System;
using UnityEngine;

public class MyGame : MonoBehaviour {
    public Camera cam;
    public bool secondBool = false;
}

In the Editor folder :

CustomEditor.cs :

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(MyGame))]
public class MyGameEditor : Editor {
    SerializedProperty cam;
    SerializedProperty secondBool;
    void OnEnable() {
        cam = serializedObject.FindProperty ( "cam" );
        secondBool = serializedObject.FindProperty ( "secondBool" );
    }
    public override void OnInspectorGUI ( ) {
        EditorGUILayout.PropertyField ( cam );
        GUI.enabled = ! cam.boolValue;
        EditorGUILayout.PropertyField ( secondBool );
        GUI.enabled = true;
        serializedObject.ApplyModifiedProperties ( );
        serializedObject.Update ( );
    }
}

i am getting an error with :


GUI.enabled = ! cam.boolValue;
EditorGUILayout.PropertyField ( secondBool );
GUI.enabled = true;

the error is :

type is not a supported int value
UnityEditor.SerializedProperty:get_boolValue()
visual stag
#

Cam is not a Boolean value

#

It is an Object reference

#

So compare it's objectReferenceValue to null

whole steppe
#

@visual stag how would i do this?

visual stag
#

GUI.enabled = cam.objectReferenceValue != null;

whole steppe
#

@visual stag ok this worked PERFECTLY! Thank you! Only problem is, i'm receiving an error with :

public override void OnInspectorGUI ( ) {
    EditorGUILayout.PropertyField ( cam );
    GUI.enabled = cam.objectReferenceValue != null;
    EditorGUILayout.PropertyField ( hidingBool );
    GUI.enabled = ! hidingBool.boolValue;
    EditorGUILayout.PropertyField ( secondBool );
    GUI.enabled = true;
    serializedObject.ApplyModifiedProperties ( );
    serializedObject.Update ( );
}

specifically these 2 lines :

EditorGUILayout.PropertyField ( hidingBool );
GUI.enabled = ! hidingBool.boolValue;

I get the error :

type is not a supported int value
UnityEditor.SerializedProperty:get_boolValue()
visual stag
#

what is hidingBool

whole steppe
#

@visual stag in CustomEditor.cs :

void OnEnable() {
    cam = serializedObject.FindProperty ( "cam" );
    hidingBool = serializedObject.FindProperty ( "hidingBool" );
    secondBool = serializedObject.FindProperty ( "secondBool" );
}

in MyGame.cs :

public class MyGame : MonoBehaviour {
    public Camera cam;
    public bool hidingBool = false;
    public bool secondBool = false;
}
visual stag
#

no idea then, seems fine

whole steppe
#

@visual stag well, it's specifically pointing to this line :

EditorGUILayout.PropertyField ( hidingBool );
whole steppe
#

@visual stag how do i disable something only when both camera & target are not null? :

MyGame.cs :

using System;
using UnityEngine;

public class MyGame : MonoBehaviour {
    public Camera cam;
    public Transform target;
    public bool hidingBool = false;
    public bool secondBool = false;
}

CustomEditor.cs :

public class MyGameEditor : Editor {
    SerializedProperty cam;
    SerializedProperty target;
    SerializedProperty hidingBool;
    SerializedProperty secondBool;
    void OnEnable() {
        cam = serializedObject.FindProperty ( "cam" );
        hidingBool = serializedObject.FindProperty ( "hidingBool" );
        secondBool = serializedObject.FindProperty ( "secondBool" );
    }
    public override void OnInspectorGUI ( ) {
        EditorGUILayout.PropertyField ( cam );
        GUI.enabled = cam.objectReferenceValue != null;
        EditorGUILayout.PropertyField ( hidingBool );
        // GUI.enabled = ! ( target as MyGame ).hidingBool;
        EditorGUILayout.PropertyField ( secondBool );
        GUI.enabled = true; // ! ( target as MyGame ).secondBool;
        serializedObject.ApplyModifiedProperties ( );
        serializedObject.Update ( );
    }
}
visual stag
#

just use basic logic, &&, you know

whole steppe
#

ok

#

@visual stag like this?

GUI.enabled = cam.objectReferenceValue != null && target.objectReferenceValue != null;
visual stag
#

does it work?

whole steppe
#

@visual stag no, it gave error :

NullReferenceException: Object reference not set to an instance of an object
MyGameEditor.OnInspectorGUI ()
visual stag
#

have you assigned target?

whole steppe
#

@visual stag this is how i have target in MyGame.cs :

public Transform target;
visual stag
#

in the editor though

whole steppe
#

@visual stag here's how i have CustomEdtior.cs :

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(MyGame))]
public class MyGameEditor : Editor {
    SerializedProperty cam;
    SerializedProperty target;
    SerializedProperty hidingBool;
    SerializedProperty secondBool;
    void OnEnable() {
        cam = serializedObject.FindProperty ( "cam" );
        target = serializedObject.FindProperty ( "target" );
        hidingBool = serializedObject.FindProperty ( "hidingBool" );
        secondBool = serializedObject.FindProperty ( "secondBool" );
    }
    public override void OnInspectorGUI ( ) {
        EditorGUILayout.PropertyField ( cam );
        EditorGUILayout.PropertyField ( target );
        GUI.enabled = cam.objectReferenceValue != null && target.objectReferenceValue != null;
        EditorGUILayout.PropertyField ( hidingBool );
        // GUI.enabled = ! ( target as MyGame ).hidingBool;
        EditorGUILayout.PropertyField ( secondBool );
        GUI.enabled = true; // ! ( target as MyGame ).secondBool;
        serializedObject.ApplyModifiedProperties ( );
        serializedObject.Update ( );
    }
}
#

it is now erroring on this line :

EditorGUILayout.PropertyField ( cam );
NullReferenceException: Object reference not set to an instance of an object
MyGameEditor.OnInspectorGUI
visual stag
#

I have no ideas, either you're doing something really weird or your names don't actually match up

whole steppe
#

@visual stag it was just a cache glitch. its working now! thank you!

whole steppe
#

@visual stag : how can i have it where if cam & target aren't both null AND the hidingBool checkbox is selected, it disables everything else?

public override void OnInspectorGUI ( ) {

    EditorGUILayout.PropertyField ( cam );
    EditorGUILayout.PropertyField ( target );
    GUI.enabled = cam.objectReferenceValue != null && target.objectReferenceValue != null;

    EditorGUILayout.PropertyField ( hidingBool );
    EditorGUILayout.PropertyField ( secondBool );

    GUI.enabled = ! hidingBool.boolValue;
    GUI.enabled = true;

    serializedObject.ApplyModifiedProperties ( );
    serializedObject.Update ( );

}
visual stag
#

again, it's just basic logic

#

I really don't want to help with constructing what amounts to "if this and this" statements

vernal belfry
#

How could i run an update method in edit mode? I would like to catch when the editor resolution is changed and the only thing i came of was to check the resolution all the time until it changes

#

any idea?

vernal belfry
#

yes, that tells you the width, but i want to capture whenever it changes

#

i think i found it

#

[ExecuteInEditMode]

#

i can make a script checking the ScreenWidth there

#

(ill try)

summer basin
#

Oh... okay, didnt know how basic we have to approach this, sorry. Yeah, thats the one to check in edit mode 🙂

vernal belfry
#

👍

onyx harness
#

EditorApplication.update otherwise

#

or perhaps hook in main window's some events via UI Toolkit

vernal belfry
onyx harness
#

2nd is much more complex

#

but might be the finest

vernal belfry
#

UI toolkit you mean?

#

im looking for info

#

didnt even know there was a ui toolkit

#

cant find it in the package manager

#

this seems to do what i want

#

i will take a look to the UI Toolkit if i have some time some day 😅

vernal belfry
#

okay this is nuts

#

anybody knows why Screen.width gives a different value whenever im moving the mouse around?

onyx harness
#

is it random? Or is it the width of the hovered window?

vernal belfry
#

these 2 are being alternatively shown when moving in the game window which is 2436x1125

onyx harness
#

That's maybe why i never liked Screen.width

vernal belfry
#

do i have an alternative?

onyx harness
#

Well my preferred way is Main window via UI Toolkit

vernal belfry
#

main window means Game window?

#

because thats what i want

onyx harness
#

Nope, you want the Unity Editor window right?

#

Oh

vernal belfry
#

nnonono

#

i want the Game window

#

sorry for the mis...

#

miss....

#

shit my english is fading

#

im tired

#

🤣

onyx harness
#

Have you looked at Screen.resolutions?

vernal belfry
#

yeah but screen resolution doesnt even change when i change from that tag

#

i suspect is taking the monitor resolution

onyx harness
#

yep, it gives available resolution

#

You want the real physical Game window size?

#

Or the rendered?

vernal belfry
#

it changes briefly to other values but when stop moving comes back to the correct one

onyx harness
#

oh

vernal belfry
#

its bothering but maybe i can work with that

onyx harness
#

the rendered one

vernal belfry
#

damn i would never think this would become such a trouble

onyx harness
#

In total honesty, it's really not that easy

#

Maybe I missed the normal way

#

But the Reflection way contains 3 4 layers

#

FYI, you need:
GameView.selectedSizeIndex & GameView.currentSizeGroupType

#

In the picture above, you need group.GetGameViewSize()

torn shore
#

how to assign a sprite to prefab, without using resource.load? , through script, it should basically point to normal asset folder like Assets/Sprites/Monkey

quaint zephyr
#

Woah @onyx harness I just realized that you're the author of NG Tools! Bravo!

vernal belfry
blissful burrow
#

has anyone else had issues with reorderable list and context menus in Unity 2019 specifically?

#

my use case is a color field property in a reorderable list element

#

right click -> copy/paste is broken, but only in Unity 2019 - it works fine in 2018 and 2020

#

the color field is drawn using Unity's color field property attribute

#

broken as in, it doesn't copy/paste anything when you press copy/paste

vernal belfry
#

is that really you? the youtuber? @blissful burrow

visual stag
#

It's someone with the exact same name

#

and profile picture, and nickname

vernal belfry
#

yeah i thought so.. but also thought why would want someone impersonate her

visual stag
#

I'm kidding, of course it's them, why are you asking?

vernal belfry
#

i didnt know she was that famous...

#

ah really?

#

no nothing, her face looks familiar, and then i googled and seems i saw some of her maths video once and find it entertaining, nothingelse

#

im not too much intto social media so i dont know if shes popular or ....

visual stag
blissful burrow
#

I don't have code in isolation to test it with, but yeah, ReorderableList, drawElementCallback with an EditorGUI.PropertyField with a property that is marked with the color field attribute

blissful burrow
visual stag
#

By Color field attribute do you mean ColorUsage?

blissful burrow
#

yeah!

#

although lemme double check something

#

I might have done some shenanigans

#

yeah, no shenanigans

#

should work fine

visual stag
#

Seems to work fine here

blissful burrow
#

the fact that it works in 2018 and 2020 is weird too

#

hm

visual stag
#

Ah sorry, looking at wrong Unity version, I'll try 2019.4

blissful burrow
#

seems to be some input/GUI event related thing - in 2019, clicking copy/paste selects the reorderable element instead of acting on the context menu

visual stag
#

Oh yeah, it doesn't work at all, the copy doesn't go through

blissful burrow
#

;-;

#

well, good, I can blame unity then~

#

thanks a ton for double checking!

visual stag
#

Unity please hcjTrash

#

It's fun that you can copy it from 2020

#

seeing as it is text

#

and paste it into another field

#

you just cannot paste it into the color fields

blissful burrow
#

oh - it works in 2020 just fine for me

visual stag
#

Yup, 2020 is great, I mean you can copy from 2020 to 2019

blissful burrow
#

oh, gotcha, haha

#

neat

waxen sandal
#

Yeah pretty sure I ran into the same issue

fair helm
#

When you use MessagePack you need to call a certain editor extension to get it working with il2cpp. Is it possible to call that from a IPreprocessBuildWithReport?

#

It would be at <Windows -> MessagePack -> CodeGenerator> (if that helps)