GithubHelp home page GithubHelp logo

codewriter-packages / tri-inspector Goto Github PK

View Code? Open in Web Editor NEW
898.0 898.0 41.0 421 KB

Free inspector attributes for Unity [Custom Editor, Custom Inspector, Inspector Attributes, Attribute Extensions]

License: MIT License

C# 100.00%
attributes extension inspector naughty unity unity-asset unity-editor unity3d unity3d-plugin

tri-inspector's People

Contributors

alexejhero avatar govorunb avatar hoshiza avatar lunalunachi avatar somedeveloper00 avatar tsfreddie avatar vanifatovvlad avatar xarpen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tri-inspector's Issues

Conflict with EasyButtons causes TriInspector to not draw

Describe the bug

When a project has EasyButtons installed via PackageManager (https://github.com/madsbangh/EasyButtons) when TriInspector is installed, it would appear that TriInspector does not draw. I am guessing that EasyButtons is also drawing the inspector and does so after or in conflict with TriInspector.

EasyButtons is an older package which has a [Button] attribute as well, so this might be something that comes up for other potential users of TriInspector.

Expected behavior

TriInspector should draw.

Code Sample

To fix, uninstall EasyButtons before installing TriInspector. Then replace using EasyButtons with using TriInspector and in most cases the attribute signature remains the same.

// 

Screenshots

Desktop:
Unity version:
Tri Inspector version:

MeshFilter inspector is not drawn

WTR:

  1. Create empty project (tested on Unity 2021.3.5f1)
  2. Create any default 3d object (for example 3D Object / Cube).
  3. Select created game object and see that MeshFilter inspector is drawn (you can see and edit Mesh field).
  4. Add Tri-Inspector package and run Installer.unitypackage
  5. Discover that MeshFilter inspector is not drawn anymore (you can see only caption).

Note: You can still see Mesh field if inspector is in the debug mode. If you add serialized Mesh field to your scripts it is visible in the inspector, so looks like the issue is with MeshFilter component only.

List inside a Box Group has no spacing at the top.

Describe the bug
If you declare a box group and then put a list inside it, the list is drawn hard up against the bottom of the box title.

Expected behavior
Expected to be a gap

Screenshots
image

Desktop: Windows 10
Unity version: 2022.1.24
**Tri Inspector version: 1.10

ReadOnly doesn't work with InlineEditor

Describe the bug
A serialized property in a class with the [ReadOnly] attribute becomes editable when it is declared with the [InlineEditor]

Expected behavior

The [ReadOnly] attribute must be active for all time.
Code Sample

// 

[Serializable]
public class Data
{
  [SerializedField,ReadOnly]
  private float a; // a is not editable in inspector here :)
}
public class Test : MonoBehaviour
{
  [SerializedField,InlineEditor]
  private Data data; // data.a become editable in inspector here :(
}

**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->

**Desktop:** <!-- e.g. Windows 11 -->
**Unity version:** <!-- e.g. 2021.3.33f1 -->
**Tri Inspector version:** <!-- e.g. 1.13.2 -->

InfoBox doesn't update visibility immediately if showif condition changes

Describe the bug
Add an InfoBox attribute to a field.
Give the InfoBox a 'showif' parameter
Observe showif is initially respected.
Change state such that showif result would change
Observe the visibility of the InfoBox does not change until you navigate away or cause some other update of the inspector

Expected behavior
Changing the state such that the showif result would change should update visibility immediately.

Code Sample

[InfoBox("Some message", TriMessageType.Info, "$SomeConditionCheck")]
private int field;

Desktop: Windows 10
Unity version: 2021.1.24
Tri Inspector version: 1.10.1

Dropdown attribute not updating Object nor applying to it properly/on time

Describe the bug
Dropdown attribute not working as expected. it updates on specific timing that's not on par with the serializableObejct.Apply...() nor serializableObject.Update(). so it neither receives data on time nor applies it on time

Expected behavior
update like other (i.e. float) fields

Code Sample
the editor window is here
and the class itself is here (look for word 'dropdown')

Screenshots
here's a video demonstrating the problem

out.mp4

Desktop: Windows 10
Unity version: 2021.2.13f1
Tri Inspector version: 1.9.7

[TextArea] not working on 2022.1.0b10.2818 with TriInspector installed

Discussed in https://github.com/codewriter-packages/Tri-Inspector/discussions/24

Originally posted by piscopancer July 15, 2022
textfield of a string property becomes invisible when textarea attribute is assigned. I have a large poem to write in inspector though. my version is 1.6.0. I have tried it with different versions of Unity starting from 2021s and nowhere does it seem working. Can you check it out on your own bcs I still doubt that it is a 100% my setup error. โ˜บ

BTW what I mean by not working is that there are 2 cases in one of which the whole textField of a string in inspector is invisible and in another case that TextArea sliders on the right truly appear BUT the textField remains invisible anyway.

TableList is not draggable

Describe the bug
TableList is not draggable. Try "Tri Samples" have the same error.

Code Sample

[TableList(Draggable = true,
            HideAddButton = false,
            HideRemoveButton = false,
            AlwaysExpanded = false
)]

Unity version: 2021.3.7f1
Tri Inspector version: 0.18

Group content box not draw correctly.

Describe the bug
i expect it should have body box like in screenshot in readme. but after i try, it did not have box on content. so i think it is a bug?

Code Sample
From Tri-inspector sample code.

using UnityEngine;
using TriInspector;

[DeclareBoxGroup("box", Title = "My Box")]
[CreateAssetMenu(fileName = "BoxGroupSample", menuName = "BoxGroupSample")]
public class BoxGroupSample : ScriptableObject
{
    [Group("box")] public int a;
    [Group("box")] public bool b;
}

Screenshots
This what i do for test;
devenv_UO49QyNpDY

Expected result: (Having content box)
firefox_6VSRHRjEri

Result: (Not having content box)
Unity_38q94fDX9l

Desktop: Windows 10
Unity version: 2021.3.15f1
Tri Inspector version: 1.9.7

[Unity 2019] No overload for method 'DoAddButton' takes 2 arguments

Describe the bug
Installing tri inspector results in this error in the console:

Library\PackageCache\com.codewriter.triinspector@0e23ca4\Unity.InternalAPIEditorBridge.012\ReorderableListProxy.cs(66,31): error CS1501: No overload for method 'DoAddButton' takes 2 arguments

Unity version: 2019.4.36f1
Tri Inspector version: 0e23ca4 (1.13.2)

Conflict with MyBox.

Describe the bug

Hello.
Today, I installed TriInspector and nothing was working, and it seems TriInspector conflicts with installation of MyBox.

Install MyBox and all TriInspector's attributes are ignored silently. No Error. MyBox side works fine. As soon as I uninstall MyBox, all things go back to normal. Samples from Tools menu works fine regardless.

Desktop:
MacOS 13.6
Unity version:
Tested with 2023.2.20f1
Tri Inspector version:
1.14.0

unity [Range] attribute don't display correctly when using Tri Inspector

Describe the bug
Unity [Range] attribute don't show correctly with Tri inspector, and float field exceed inspector width.
When part of an horizontal group, sliders width get wrong and can overlap with label.
Expected behavior
[Range] attribute show correctly in all cases

Code Sample

using TriInspector;
using UnityEngine;

[DeclareBoxGroup("Test")]
[DeclareHorizontalGroup("TestHorizontal")]
public class TestComponent : MonoBehaviour
{
    [Range(0, 1)]
    public float simpleRange;

    [Group("TestHorizontal"), Range(0, 1)]
    public float horizontalRange1;
    [Group("TestHorizontal"), Range(0, 1)]
    public float horizontalRange2;
}

Screenshots
image

Desktop: Windows 11
Unity version: 2022.3.11
Tri Inspector version: 1.13.2

Script field is missing in the inspector

Describe the bug
After adding Tri-Inspector to a Unity project the script field is no longer shown on components in the inspector. Is it possible to show it again?

Screenshots
Without Tri-Inspector:
image

With Tri-Inspector:
image

Hashsets are shown as empty inline properies

Describe the bug
Hashsets are shown wrongly

Expected behavior
Hashstes shouldn't be shown in inspector, or should be shown properly

Code Sample

public HashSet<string> registeredChannels

Screenshots
image

Desktop: Windows 10
Unity version: 2021.2.13f1
Tri Inspector version: 1.9.6

Unable to add package in Unity 2020.3.48f1

Describe the bug
I wanted to replace Odin Inspector with Tri-Inspector in one of my open-source sample.
I followed install instruction from Readme, but bump with error:

[Package Manager Window] Unable to add package [https://github.com/codewriter-packages/Tri-Inspector.git]:
  Package com.codewriter.triinspector@https://github.com/codewriter-packages/Tri-Inspector.git has invalid dependencies or related test packages:
    com.unity.localization (dependency): Package [[email protected]] cannot be found
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

Is Tri-Inspector compatible only with Unity 2021+?

Expected behavior
I expected everything will be going smooth as butter.

Screenshot
image

Desktop: Windows 10 LTSC
Unity version: 2020.3.48f1
Tri Inspector version: Latest

issue with displaying Dictionary types

Describe the bug
The TriInspector probably doesn't serialize and support dictionaries, but for some reason it trys. and as a result, a broken inspector will be shown for them

Expected behavior
Either don't show them or show them properly

Code Sample

public Dictionary<string, Object> listeners;

Screenshots
image

Desktop: Windows 10
Unity version: 2021.2.13f1
Tri Inspector version: 1.9.5

Collections do not display element index.

Describe the bug
Collections such as List and Array do not show the index of each element. Problem may exists for other colllection types as well.

Expected behavior
Show indexes to elements.

Code Sample

public class NoIndexDemo : MonoBehaviour
{
    public List<int> _lst;
    public int[] _arry;
}

Screenshots
image

Unity version: 2019, 2020, 2021 LTS
Tri Inspector version: 1.13.0

ROADMAP (Github's Star driven)

The following features will be added to the Tri Inspector when the required number of GitHub Repo stars is reached on the project page.

25 โ˜… - Add EnumToggleButtons attribute [โœ“ DONE]

35 โ˜… - Add TableList attribute [โœ“ DONE]

50 โ˜… - Add AssetsOnly attributes [โœ“ DONE]

65 โ˜… - Add Dropdown attribute [โœ“ DONE]

85 โ˜… - Add SceneObjectsOnly attributes [โœ“ DONE]

100 โ˜… - Add Scene attributes

[Scene] public string sceneName;
[Scene] public int sceneIndex;

125 โ˜… - Add ChildGameObjectsOnly attributes

[ChildGameObjectsOnly] public GameObject asset;

165 โ˜… - Add ParentGameObjectsOnly attributes

[ParentGameObjectsOnly] public GameObject sceneObject;

200 โ˜… - Add Foldout group

[DeclareFoldoutGroup("demo")]
public class DemoClass {
    [Group("demo")] public bool;
    [Group("demo")] List<Vector3> list;
}

500 โ˜… - Add TriMenuEditorWindow

Soon

Any suggestions for new attributes? Write them in the comments


Bug draw custom property type in unity 2022.2

Describe the bug
Dupplicate draw field when attach value for field after attach component to GameObject.

Wrong positon draw field

I was check with Unity 2021.3 and it still work correctly

Expected behavior

  • Attach script to GameObject
  • Change the value of field

Code Sample
Create class player look like

public class Player : MonoBehaviour
{
    public string id;
}

And create CustomPropertyDrawer for it

[CustomPropertyDrawer(typeof(Player))]
public class PlayerPropertyEditor : PropertyDrawer
{
    private SerializedObject _serializedObject;

    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);
        var targetObject = property.objectReferenceValue;
        if (targetObject == null)
        {
            EditorGUI.PropertyField(position, property, label);
            EditorGUI.EndProperty();
            return;
        }

        if (_serializedObject == null || _serializedObject.targetObject != targetObject) _serializedObject = new SerializedObject(targetObject);

        _serializedObject.UpdateIfRequiredOrScript();

        var rect = position;
        var labelRect = position;
        labelRect.width = position.width * 0.4f;
        property.isExpanded = EditorGUI.Foldout(labelRect, property.isExpanded, new GUIContent(""), true);

        if (property.isExpanded)
        {
            //Draw property on the full width
            rect.width = position.width;
            EditorGUI.PropertyField(rect, property, label);

            EditorGUI.indentLevel++;
            GUILayout.BeginVertical(GUI.skin.box);
            DrawInspectorExcept(_serializedObject, new[] {"m_Script"});
            GUILayout.EndVertical();
            EditorGUI.indentLevel--;
        }

        _serializedObject.ApplyModifiedProperties();
        EditorGUI.EndProperty();
    }

        public static void DrawInspectorExcept(SerializedObject serializedObject, string[] fieldsToSkip)
        {
            serializedObject.Update();
            var prop = serializedObject.GetIterator();
            if (prop.NextVisible(true))
            {
                do
                {
                    if (fieldsToSkip.Any(prop.name.Contains)) continue;

                    EditorGUILayout.PropertyField(serializedObject.FindProperty(prop.name), true);
                } while (prop.NextVisible(false));
            }

            serializedObject.ApplyModifiedProperties();
        }
}

Now can test with sample demo

using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    public Player player;
    public float damage;
}

Screenshots
image

image

Desktop: Windows 11
Unity version: 2022.2.11f1
Tri Inspector version: 1.10.0

Got error when click on folder/item

Describe the bug

TriAssetImporterEditor.OnInspectorGUI must call ApplyRevertGUI to avoid unexpected behaviour.
UnityEditor.AssetImporters.AssetImporterEditor:OnDisable ()
TriInspector.TriAssetImporterEditor:OnDisable () (at ./Library/PackageCache/com.codewriter.triinspector@04ad48abec/Editor/TriEditor.cs:28)

Expected behavior
No error

Screenshots
image

Desktop:
Unity version:
Tri Inspector version:

Compile errors on new install with odin 2.1.13.0 on unity 2021.3.38f1

Describe the bug
Compile errors on new install with odin 2.1.13.0 on unity 2021.3.38f1

Expected behavior
no compile errors

Library\PackageCache\com.codewriter.triinspector@0c5b8f4480\Editor.Integrations\Odin\OdinObjectValidator.cs(21,30): error CS0115: 'OdinObjectValidator<T>.CanValidateProperty(InspectorProperty)': no suitable method found to override
Library\PackageCache\com.codewriter.triinspector@0c5b8f4480\Editor.Integrations\Odin\OdinObjectValidator.cs(49,33): error CS0115: 'OdinObjectValidator<T>.Validate(ValidationResult)': no suitable method found to override
Library\PackageCache\com.codewriter.triinspector@0c5b8f4480\Editor.Integrations\Odin\OdinObjectValidator.cs(11,18): error CS0534: 'OdinObjectValidator<T>' does not implement inherited abstract member 'ValueValidator<T>.Validate(T, ValidationResult)'

Desktop: Windows 10
Unity version: 2021.3.38f1
Tri Inspector version: v1.14.0

Does not work for children of NetworkBehaviour

Describe the bug
For classes inherited from Unity.Netcode.NetworkBehaviour no attributes are drawn.

For other classes, even in the same assembly, even inherited from other abstract classes (which in turn are inherited from MonoBehaviour) works fine.

Maybe the error is not connected with NetworkBehaviour, or Unity did some nasty things there, or the error is mine, don't know :)

Expected behavior
Drawn attributes, as usual.

Code Sample

using TriInspector;
using Unity.Netcode;
using UnityEngine;

public class Test: NetworkBehaviour
{
    [SerializeField]
    private bool isSynced = false;

    [InfoBox(
        "oh no",
        TriMessageType.Warning
    )]
    [SerializeField]
    [EnableIf(nameof(isSynced))]
    private int syncActionType;
}

Screenshots
image

Desktop: Windows 11
Unity version: 2023.2.4f1
Tri Inspector version: 1.13.2

Visual bug: Class instance "arrow sign" in the BoxGroup

The foldout arrow is outside BoxGroup (probably any group tho)

Expected to be placed little bit to the right (with offset of about 20-50 pixels idk)

Screenshots
image

Windows 10
2022.1.0b10.2818
1.8.0

THE SOLUTION FOR THIS MAY BE:

image
so I have simply added Indent like this

 [SerializeField, Group("Presets"), Indent(1)] CameraPreset presetMenu, presetGuns, presetCharacter;

and it worked nicely.
So can you somehow automate/fix/solve it?

ReorderableList conflict in 2020.3.22f1+

Describe the bug

On Unity 2020.3.22f1 (and assuming later versions as well)

On install:
Library\PackageCache\com.codewriter.triinspector@692dfb6\Unity.InternalAPIEditorBridge.012\ReorderableListProxy.cs(42,18): error CS1061: 'ReorderableList' does not contain a definition for 'InvalidateCacheRecursive' and no accessible extension method 'InvalidateCacheRecursive' accepting a first argument of type 'ReorderableList' could be found (are you missing a using directive or an assembly reference?)

Expected behavior

No errors should present.

Code Sample

To fix, in ReorderableListProxy:41, remove the bit that says UNITY_2020_3

Error when installing from upm

Describe the bug

Error when installing from upm

Expected behavior

Installed without error

Screenshots

image

Desktop: Windows 10
Unity version: 2020.3.38f1 and 2021.3.9f1
Tri Inspector version: 1.9.1

Serialized Color32 fields are not visible in the inspector

WTR:

  1. Create empty project (tested on Unity 2021.3.5f1)
  2. Create script with serialized Color32 field, for example [SerializeField] private Color32 _color;
  3. Add this script to game object and see that field "Color" is visible in the inspector.
  4. Add Tri-Inspector package and run Installer.unitypackage
  5. Discover that field "Color" is not visible in the inspector anymore.

Note: Field is still visible if the inspector is in the debug mode.

Serializable structs with explicit layout

Describe the bug
Can`t edit area of effects values
Expected behavior
able to edit area of effect values

Code Sample



[Serializable]
[StructLayout(LayoutKind.Explicit)]
public struct GameplayAction
{
    [FieldOffset(0)]
    public GameplayActionType Type;

    [FieldOffset(4)]
    [ShowIf(nameof(Type), GameplayActionType.SpawnProjectile)]
    public SpawnProjectileAction SpawnProjectile;

    [FieldOffset(4)]
    [ShowIf(nameof(Type), GameplayActionType.ApplyEffect)]
    public ApplyEffectAction ApplyEffect;

    [FieldOffset(4)]
    [ShowIf(nameof(Type), GameplayActionType.ApplyAreaOfEffect)]
    public AreaOfEffectShape AreaOfEffect;

    [FieldOffset(4)]
    [ShowIf(nameof(Type), GameplayActionType.SpawnAreaOfEffect)]
    public SpawnAreaOfEffectAction SpawnAreaOfEffect;
}
// 

Screenshots

Desktop: Windows 11
**Unity version: 2020.3.35f1
image

Tri Inspector version: 1.1.01

Serialized property bug

Describe the bug

For serialized properties changing fields with reference types (AnimationCurve, Gradient) doesn't mark object as dirty

Expected behavior
After changing values object marks as dirty

Code Sample

Changing values inside testField works as intended, but not for TestProperty

public class CurveTest : MonoBehaviour
{
    public NestedReferenceTest testField;

    [ShowInInspector]
    [InlineProperty]
    [HideLabel]
    [PropertySpace]
    public NestedReferenceTest TestProperty
    {
        get => testField;
        set => testField = value;
    }
}

[Serializable]
public class NestedReferenceTest
{
    public AnimationCurve curve;
    public Gradient gradient;
    public float floatValue;
}

The problem is in the TriValue.SmartValue I suppose - comparer for reference values always returns true

        [PublicAPI]
        public T SmartValue
        {
            get => (T) Property.Value;
            set
            {
                if (Property.Comparer.Equals(Property.Value, value))
                {
                    return;
                }

                Property.SetValue(value);
            }
        }

Desktop: Windows 10
Unity version: 2022.3.16f1
Tri Inspector version: 1.13.2

After install has compile errors

Clear Unity 2021.3.8 URP project. It may be something with assemblies.

Library\PackageCache\com.codewriter.triinspector@a1fd95dc2e\Editor\Elements\InlineEditorElement.cs(2,7): error CS0246: The type or namespace name 'TriInspectorUnityInternalBridge' could not be found (are you missing a using directive or an assembly reference?)
Library\PackageCache\com.codewriter.triinspector@a1fd95dc2e\Editor\Elements\TriBuiltInPropertyElement.cs(1,7): error CS0246: The type or namespace name 'TriInspectorUnityInternalBridge' could not be found (are you missing a using directive or an assembly reference?)
Library\PackageCache\com.codewriter.triinspector@a1fd95dc2e\Editor\Elements\TriInfoBoxElement.cs(2,7): error CS0246: The type or namespace name 'TriInspectorUnityInternalBridge' could not be found (are you missing a using directive or an assembly reference?)
Library\PackageCache\com.codewriter.triinspector@a1fd95dc2e\Editor\Elements\TriListElement.cs(3,7): error CS0246: The type or namespace name 'TriInspectorUnityInternalBridge' could not be found (are you missing a using directive or an assembly reference?)
Library\PackageCache\com.codewriter.triinspector@a1fd95dc2e\Editor\Elements\TriPropertyElement.cs(2,7): error CS0246: The type or namespace name 'TriInspectorUnityInternalBridge' could not be found (are you missing a using directive or an assembly reference?)
Library\PackageCache\com.codewriter.triinspector@a1fd95dc2e\Editor\Utilities\TriManagedReferenceGui.cs(4,7): error CS0246: The type or namespace name 'TriInspectorUnityInternalBridge' could not be found (are you missing a using directive or an assembly reference?)
Library\PackageCache\com.codewriter.triinspector@a1fd95dc2e\Editor\Elements\TriBuiltInPropertyElement.cs(10,26): error CS0246: The type or namespace name 'PropertyHandlerProxy' could not be found (are you missing a using directive or an assembly reference?)
Library\PackageCache\com.codewriter.triinspector@a1fd95dc2e\Editor\Elements\TriBuiltInPropertyElement.cs(16,13): error CS0246: The type or namespace name 'PropertyHandlerProxy' could not be found (are you missing a using directive or an assembly reference?)

EnumToggleButtons not working with enum flags

Describe the bug
The attribute, [EnumToggleButtons], does not support flagged enums, despite the images showing it in the read me. When clicking on an enum, it will remove all other values and only set the value to the recently selected enum.

Expected behavior
Multiple flags can be applied at once.

Code Sample
The problem is in EnumToggleButtonsDrawer -> OnGUI, where the code on line 75 overwrites the property value with the changed value. When there is a flag, it should only toggle the bit values. I tried modifying the code to get it to work demonstrated with the yellow highlighting in the image below, and it seems to work. There are probably cleaner ways to do it, but this solves it for me for now.
image

Desktop: Windows 10
Unity version: 2020.3.25f1
Tri Inspector version: 1.9.6

GuiSkin is broken when used with TriInspector

Describe the bug
When i create a new guiskins
Unity GUISkins are not drawn correctly on Inspector (Object Serialize, ReorderList)

Expected behavior
Draw the information of the object, the list of the correct GuiSkins file

Screenshots
image

Desktop: Windows 11
Unity version: 2021.3.8f1
Tri Inspector version: 1.9.2

TableList displaying normal list in inspector

I've been trying to get the TableList working with a custom class I've created, but it kept displaying a normal list inspector.
I also tried using the TableList sample to check if that works, but the same applies (as seen in screenshot below).

Screenshots
image

Desktop: Windows 10
Unity version: Unity 2022.1.18f1
Tri Inspector version: 1.10.1

Exception: 'ReorderableList' does not contain a definition for 'ClearCacheRecursive'

WTR:

  1. Download Tri-Inspector into your project (tested on the latest Unity 2021.3.5f1)
  2. Run Installer.unitypackage
  3. Discover exception Assets/Tri-Inspector/Unity.InternalAPIEditorBridge.012/ReorderableListProxy.cs(26,18): error CS1061: 'ReorderableList' does not contain a definition for 'ClearCacheRecursive' and no accessible extension method 'ClearCacheRecursive' accepting a first argument of type 'ReorderableList' could be found (are you missing a using directive or an assembly reference?)

[Request] Add compared value to ShowIf, HideIf, EnableIf, DisableIf

public SomeEnum someEnum;
public bool someBool;

[ShowIf(nameof(someEnum), SomeEnum.Two)]
public bool val;

[ShowIf(nameof(someBool), true)] // Same as [ShowIf(nameof(someBool))]
public float f1;

[ShowIf(nameof(someBool), false)]
public float f2;

public enum SomeEnum { One, Two }

Inline (Material) Editor does not always display correctly (if new value is assigned to target value)

Describe the bug

When using an attribute
[InlineEditor] public Material mat;
the inline editor sometimes fails to draw (empty, reported height=0) completely in case one assign a new Material to the mat variable from the Inspector.

Reason seems to be:
In InlineEditorElement.cs
When assigning a new value via the inspector the call to
InternalEditorUtilityProxy.SetIsInspectorExpanded is omitted. This call only happens when the element is attached to a panel.
See InlineEditorElement.OnAttachToPanel().
Depending on the Material's state the InlineEditor sometimes does draw. Especially if you switch to a different MonoBehaviour and back.

Possible Fix:

public override void OnGUI(Rect position)
{
...
    if (_editor == null && shouldDrawEditor && _property.Value is Object obj && obj != null)
    {
        _editor = Editor.CreateEditor(obj);
        if (obj != null && !InternalEditorUtilityProxy.GetIsInspectorExpanded(obj))
        {
             InternalEditorUtilityProxy.SetIsInspectorExpanded(obj, true);
        }
    }
... 

Desktop:
Windows 10
Unity version:
2022.3.10f1
Tri Inspector version:
1.13.2

[Request] Add TableList attribute

TableList

[TableList] public List<TableItem> table;

[Serializable]
public class TableItem
{
    public Texture icon;
    public string description;

    [Group("Combined"), LabelWidth(16)]
    public string A, B, C;

    [Button, Group("Actions")]
    public void Test1() { }

    [Button, Group("Actions")]
    public void Test2() { }
}

UnityEvent don't show their field name in inspector

Describe the bug
UnityEvent don't show their field name in inspector

Expected behavior
UnityEvent show their field name in inspector

Code Sample

{
    public UnityEvent testevent;
    public UnityEvent<float> testevent2;
}

Screenshots

With Tri-Inspector installed
image

Without Tri-Inspector installed:
image

Desktop: Windows 11
Unity version: 2022.3.8
Tri Inspector version: 1.13.1

Reproduced in an empty project.

RectOffset draw not correctly

Describe the bug
Properties with data type RectOffset are not drawn correctly outside the inspector

Expected behavior
Draw full properties of class RectOffset

Like this

image

Code Sample

using UnityEngine;

public class Demo : MonoBehaviour
{
    public RectOffset offset;
}

Screenshots
image

Desktop:
Unity version:
Tri Inspector version:

No GUI Implemented in Unity 2022

Describe the bug
When using CreatePropertyGUI() for custom PropertyDrawers, a No GUI Implemented error is displayed.

Expected behavior
A custom PropertyDrawer should be displayed.

Code Sample

using UnityEngine;

public enum IngredientUnit { Spoon, Cup, Bowl, Piece }

// Custom serializable class
[Serializable]
public class Ingredient
{
    public string name;
    public int amount = 1;
    public IngredientUnit unit;
}

public class Recipe : MonoBehaviour
{
    public Ingredient potionResult;
    public Ingredient[] potionIngredients;
}

[CustomPropertyDrawer(typeof(Ingredient))]
public class IngredientDrawerUIE : PropertyDrawer
{
    public override VisualElement CreatePropertyGUI(SerializedProperty property)
    {
        // Create property container element.
        var container = new VisualElement();

        // Create property fields.
        var amountField = new PropertyField(property.FindPropertyRelative("amount"));
        var unitField = new PropertyField(property.FindPropertyRelative("unit"));
        var nameField = new PropertyField(property.FindPropertyRelative("name"), "Fancy Name");

        // Add fields to the container.
        container.Add(amountField);
        container.Add(unitField);
        container.Add(nameField);

        return container;
    }
}

Screenshots
image

Desktop: Windows 11
Unity version: 2022.3.4
Tri Inspector version: 1.9.6

FieldValueResolver not correct when use Condition for Array

Describe the bug
Bug condition with array not empty, seem to be error by _valueGetter(property, targetIndex) return parent not correct

Expected behavior
Draw aray element correctly without error

Code Sample

public bool isShow;

[HideIf(nameof(isShow))] public List<int> itemIds = new List<int>();

Screenshots
image

image

Desktop:
Unity version:
Tri Inspector version:

SerializeReference not applying changes to disk

Describe the bug
SerializeReference not applying changes to disk. I have some sort of data structure like the following

 [Serializable]
 public struct Item
 {
     public LocalizedString name;
     public LocalizedString description;
     public Sprite icon;
     [SerializeField] private EntityStats baseStats;
     [SerializeReference] private EntityEnhancement[] level2Enhancements;
     [SerializeReference] private EntityEnhancement[] level3Enhancements;
     [SerializeReference] private EntityEnhancement[] level4Enhancements;
...

and neither of the SerializeReference fields get saved to disk after Ctrl+S.

Expected behavior
Save to disk.

Code Sample

public sealed partial class TroopsManifest : ManifestScriptableObject<TroopsManifest.Item>
{
  // we'll have some TroopsManifest.Item[] in the base class

   [Serializable]
   public struct Item
   {
     public LocalizedString name; // saves to disk
     public LocalizedString description; // saves to disk
     public Sprite icon; // saves to disk
     [SerializeField] private EntityStats baseStats; // saves to disk
     [SerializeReference] private EntityEnhancement[] level2Enhancements; // DOESNT save to disk
     [SerializeReference] private EntityEnhancement[] level3Enhancements; // DOESNT save to disk
     [SerializeReference] private EntityEnhancement[] level4Enhancements; // DOESNT save to disk
  }
}

Screenshots
image

Desktop:
Unity version:
Tri Inspector version: latest to this date

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.