Giter Club home page Giter Club logo

one-line's People

Contributors

d4160 avatar gspidy avatar raslab avatar slavniyteo 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  avatar  avatar

one-line's Issues

Package renaming request

Hi @slavniyteo,

Favo from OpenUPM - a platform collects open-source UPM packages. First of all, thanks for creating this awesome open-source package. I am writing to you because OpenUPM is preparing to comply with Unity's Terms of Services (TOS) Updates. Your package is available on our platform, and I need your help to make some changes.

According to the Unity Package Manager Naming Convention, the package name should use reverse domain name notation, at least 3 sections joined by a dot: tld.org-name.package-name. For example com.littlebigfun.addressable-importer.

  • tld is the top-level domain, like com, org and so on. If you're not sure about what to use, please use com.
  • org-name is your organization name. With tld together it makes sure the organization name is globally unique to its registered owner. You should avoid using a tld and org-name combination that may be confusing to users, like com.unity or com.github.
  • package-name is your package name.

Your package name is st.one-line. I recommend you to update it to comply with the naming convention by,

  • change the package name in package.json.
  • bump the version field of package.json.
  • create a Git tag.

Please reply to me if you've made the change, I will update the OpenUPM side to make it live.

If you do not respond to the issue, It will be closed by the end of Jan 2021, and your package will be removed from our platform. Please notice that Unity Package Guiding Principles & Guidelines do not apply to you when you host Packages on GitHub for Unity users to download and put the Packages in their projects, as long as the hosted Package does not, directly or indirectly, leverage the Unity Editor as a marketing or distribution platform. Thus, you don't have to change anything if you don't intend to publish the package on a scoped registry (like OpenUPM).

Sorry for the inconvenience, feel free to discuss with me if you have any questions.

BR
Favo

OneLine can not initialize Inspector Window Utility

OneLine can not initialize Inspector Window Utility.
You may experience some performance issues.
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it.

System.NullReferenceException: Object reference not set to an instance of an object
at OneLine.InspectorUtil.Initialize () [0x00010] in D:\Unity Games*****\Assets\3rd party\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:51
at OneLine.InspectorUtil..ctor () [0x00039] in D:\Unity Games******\Assets\3rd party\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:41
UnityEngine.Debug:LogError (object)
OneLine.InspectorUtil:.ctor () (at Assets/3rd party/OneLine/OneLine/Editor/Utils/InspectorUtil.cs:45)
OneLine.OneLinePropertyDrawer:.ctor () (at Assets/3rd party/OneLine/OneLine/Editor/OneLinePropertyDrawer.cs:36)
UnityEditor.ScriptAttributeUtility:GetHandler (UnityEditor.SerializedProperty)
UnityEditorInternal.ReorderableList:CacheIfNeeded ()
UnityEditorInternal.ReorderableList:GetListElementHeight ()
UnityEditorInternal.ReorderableList:GetHeight ()
UnityEditorInternal.ReorderableListWrapper:GetHeight ()
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Try to optimize property.GetCustomAttributes

Check if it is a bottleneck (I think, it is a very hot method especially after adding custom drawers to v0.3.0).

If it is, add any king of caching like Dictionary<propertyPath, Attribute[]> or something else.

Add "how to build" to documentation

Yesterday tried to set up locally OneLine project to search how #38 can be fixed. But spend few hours to this :(
Reasons:

  1. I didn't found which version of Unity uses by default for plugin developing
  2. When cloned project - not clear then need to clone to assets folder
  3. After importing catch some issues with assembly definitions. Problem then in repository references between assembly definitions serialized as GUIDs (not as definitions names) and check needed reference - it's magic)
  4. And.... One of missed GUIDs referenced to assembly definition from another repository (rect-ex) )) Maybe will be better to use git submodules functionallity here?

Can you create something like CONTRIBUTING.MD (or just "How to build" paragraph in README.MD) and highlight this things there?

Error When Click on the examples

Hello, I am getting this:

OneLine can not initialize Inspector Window Utility.
You may experience some performance issues.
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it.

System.NullReferenceException: Object reference not set to an instance of an object
at OneLine.InspectorUtil.Initialize () [0x00010] in D:\Downloads\UnityVisualModelingFramework\Assets\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:51
at OneLine.InspectorUtil..ctor () [0x00039] in D:\Downloads\UnityVisualModelingFramework\Assets\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:41
UnityEngine.Debug:LogError (object)
OneLine.InspectorUtil:.ctor () (at Assets/OneLine/OneLine/Editor/Utils/InspectorUtil.cs:45)
OneLine.OneLinePropertyDrawer:.ctor () (at Assets/OneLine/OneLine/Editor/OneLinePropertyDrawer.cs:36)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Using inheritance and generics cause index out of range exception.

For example i have an abstract generic class A and inherited non-generic class B.

public abstract class A<TValue> 
{ 
    [OneLine]
    public List<TValue> List; 
}

public class B : A<ConreteValue> 
{ 
}

This case cause Index out of range exception for SerializedPropertyExtension in 104 line. You will replace

type = type.GetGenericArguments()[0];

for

if (type.GetGenericArguments().Length == 0)
{                            
    var baseType = type.BaseType;
    type = baseType.GetGenericArguments()[0];
}
else
{
    type = type.GetGenericArguments()[0];
} 

for fix it.

Error: OneLine can not initialize Inspector Window Utility.

General Info
OS: Windows 10
Unity Version: 2019.4.5f1 Personal
OneLine Version: v0.4.0
OneLine Installation: Assert Store
RectEx Version: # only if changed manually


When I select any of the example assets, the following error is printed to the console:

OneLine can not initialize Inspector Window Utility.
You may experience some performance issues.
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it.

System.NullReferenceException: Object reference not set to an instance of an object
at OneLine.InspectorUtil.Initialize () [0x00011] in C:\Users\Kevin\Documents\Unity\Editor Sandbox\Assets\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:51
at OneLine.InspectorUtil..ctor () [0x00045] in C:\Users\Kevin\Documents\Unity\Editor Sandbox\Assets\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:41
UnityEngine.Debug:LogError(Object)
OneLine.InspectorUtil:.ctor() (at Assets/OneLine/OneLine/Editor/Utils/InspectorUtil.cs:45)
OneLine.OneLinePropertyDrawer:.ctor() (at Assets/OneLine/OneLine/Editor/OneLinePropertyDrawer.cs:36)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

I have just downloaded and installed OneLine for the first time, so I can't say for sure what impact this is having. However, the message told me to post it here, so that's what I am doing.

OneLine initializer cant find CurrentInspector in 2019.2a

After upgrading to 2019.2a OneLine initializer fails with "OneLine can not initialize Inspector Window Utility.
You may experience some performance issues.
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it."

The problem is that on the Initialize() call the currentInspector window is trying to be reflected and stored in the "window" variable. Unity seems to have removed the "s_CurrentInspectorWindow" field from InspectorWindow.

OneLine still manages to work though so the only problem is performance wise probably.

Why ignore bool type when uses WidthAttribute?

Today i tried to add WidthAttribute to my bool field in table created with OneLineWithHeader and catch some strange result (image like example):
Screenshot from 2019-09-26 00-54-32

After this started ti research error and show

public float GetFixedWidth(SerializedProperty property){
switch (property.propertyType){
case SerializedPropertyType.Boolean: {
return EditorGUIUtility.singleLineHeight - 2;
}

Why?! :(

Ошибка с массивом объектов которые содержат в себе внутри массивы

Здравствуйте! Спасибо замечательный плагин!
К сожалению в процессе использования столкнулся с проблемой, которую самому быстро не удалось решить.

Есть массив объектов ScenarioItemSpawnerHolder[]
Внутри каждого из ScenarioItemSpawnerHolder есть массив Waves[], на который повешен [OneLine]
В итоге все элементы этого массива обрабатываются как Element 0 и редактируются одновременно

public class MissionGeneratorSettings : ScriptableObject
{
	public ScenarioItemSpawnerHolder[] ScenarioItemSpawners;
}

[Serializable]
public class ScenarioItemSpawnerHolder
{
	public int Length;
	public AnimationCurve Probability;
	public AnimationCurve Multiplier;
	[OneLine]
	public MobWave[] Waves;
}

Ability to use OneLine with CustomPropertyDrawer?

I'm interested in using your utility, but found one issue and now don't know can it be resolved in basics.
In my project unity3d-class-type-reference is used like this:

[Serializable]
public class LogNode {
	[ClassImplements(typeof(ILogContext))]
	public ClassTypeReference Context;
	public bool               Enabled;
}
...
public List<LogNode> Nodes = new List<LogNode>();

In standard cases ClassTypeReference instance is shown as drop-down, which allow you to select class with given constraints. ClassTypeReference used their own CustomPropertyDrawer to do it.

Problem is here: when [OneLine] attribute is used on Nodes it shown as just editable string, which is not properly usable.

It is any proposals how this issue can be resolved with/without changes in utility code?

Add settings file

Add an ability to customize the OneLine.

  • Settings window
  • Layers system:
    • Default settings (readonly);
    • Global settings, overrides default settings, serialized into ScriptableObject and passed into VCS;
    • Local settings, overrides global settings, saved via EditorPrefs on local machine.
  • Reset to default settings
  • Create if absent
  • Create if absent on first load without any customer's action like running a menu item "OneLine/Create Settings" (to work out from the box)
  • Ability to remove settings and prevent creating new copy (always work with default settings)

Settings to extract:

  • Disable OneLine for whole project
  • Disable Cache optimization
  • Disable Culling optimization
  • Disable expanding references
  • Disable Horizontal Separators
  • Disable Vertical Separators
  • Ignore Custom Drawers

InspectorUtil fall if use OneLine at editor window (not in inspector)

In case of using some global editor window with small child editors, OneLine flag in child objects can fall.

For example:

Some scriptable object

public class GlobalConfigContainer : ScriptableObject
{
    public ConfigPart part;
}

public class ConfigPart
{
    [SerializeField]
    [OneLine.OneLine]
    public SomeDatas[] dataArray;
}

Some editor window

public class GlobalConfigEditor : EditorWindow
{
    private Editor _editor;

// ......

    public override void OnInspectorGUI()
    {
        // here we creating and drawing some editor for our scriptable object
        if (_editor == null)
            _editor = CreateEditor(CreateInstance<GlobalConfigContainer>());

        _editor.DrawDefaultInspector();
    }
// ......
}

In this case we catch error because InspectorUtil can't find inspector window (in this case we using custom editor window)

OneLine can not initialize Inspector Window Utility. 
You may experience some performance issues. 
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it.
System.Reflection.TargetException: Non-static field requires a target
  at System.Reflection.MonoField.GetValue (System.Object obj) [0x0000b] in <d7ac571ca2d04b2f981d0d886fa067cf>:0 
  at OneLine.InspectorUtil.get_ScrollPosition () [0x00001] in Assets\ThirdParty\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:63 
  at OneLine.InspectorUtil.Initialize () [0x0006c] in Assets\ThirdParty\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:60 
  at OneLine.InspectorUtil..ctor () [0x00045] in Assets\ThirdParty\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:41 

One line does not work?

The OneLine examples work as instruction. But when I copy one of the example code to another .cs file and change its name, the new class does not work. Do I miss something like setting or initialize?

OneLine cannot initialize Inspector Window Utility

General Info
OS: Windows 10
Unity Version: 2020.2.0b2
OneLine Version: 0.5.1
OneLine Installation: Package Manager
RectEx Version: didnt change


Trying to use it on a list of custom struct. Im using Odin Serializer, maybe thats somehow affects it.

image

OneLine can not initialize Inspector Window Utility.
You may experience some performance issues.
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it.

System.NullReferenceException: Object reference not set to an instance of an object
at OneLine.InspectorUtil.Initialize () [0x00010] in D:\Games\Unity\MyProjects\SkatePrototypeV2\Library\PackageCache\st.one-line@3211882\Editor\Scripts\Utils\InspectorUtil.cs:51
at OneLine.InspectorUtil..ctor () [0x00039] in D:\Games\Unity\MyProjects\SkatePrototypeV2\Library\PackageCache\st.one-line@3211882\Editor\Scripts\Utils\InspectorUtil.cs:41
UnityEngine.Debug:LogError (object)
OneLine.InspectorUtil:.ctor () (at Library/PackageCache/st.one-line@321188262e/Editor/Scripts/Utils/InspectorUtil.cs:45)
OneLine.OneLinePropertyDrawer:.ctor () (at Library/PackageCache/st.one-line@321188262e/Editor/Scripts/OneLinePropertyDrawer.cs:36)
UnityEditor.ScriptAttributeUtility:GetHandler (UnityEditor.SerializedProperty)
UnityEditorInternal.ReorderableList:CacheIfNeeded (bool)
UnityEditorInternal.ReorderableList:GetListElementHeight ()
UnityEditorInternal.ReorderableList:DoList (UnityEngine.Rect,UnityEngine.Rect)
UnityEditorInternal.ReorderableListWrapper:Draw (UnityEngine.Rect,UnityEngine.Rect)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Unity can't link assembly definitions by GUIDs from startup

General Info
OS: Windows, Ubuntu
Unity Version: 2018.2.6f1 (ubuntu), 2018.4.0f1 (win), 2018.4.6f1 (win)
OneLine Version: latest master branch
OneLine Installation: Unity Package Manager


Describe the bug
STR:

  1. Create new project
  2. Add to Packages/manifest.json
{
  "dependencies": {
    "st.rect-ex": "https://github.com/slavniyteo/rect-ex.git#master",
    "st.one-line": "https://github.com/slavniyteo/one-line.git#master"
  },
  "testables": [
    "st.rect-ex",
    "st.one-line"
  ]
}
  1. Switch to Unity and catch importing errors:
Assembly has reference to non-existent assembly 'GUID:73c70a6eb6b6f444c878926f743350f6' (Packages/st.rect-ex/Tests/Editor/Unity.st.rect-ex.Editor.Tests.asmdef)
Assembly has reference to non-existent assembly 'GUID:7a0017bf928d9644fa38a04cabefce63' (Packages/st.one-line/Tests/Editor/OneLine.Tests.Editor.asmdef)
Assembly has reference to non-existent assembly 'GUID:48490628f29f5a745823c646508b1c74' (Packages/st.one-line/Documentation/Examples/OneLine.Examples.asmdef)
Assembly has reference to non-existent assembly 'GUID:73c70a6eb6b6f444c878926f743350f6' (Packages/st.one-line/Editor/OneLine.Editor.asmdef)
Assembly has reference to non-existent assembly 'GUID:73c70a6eb6b6f444c878926f743350f6' (Packages/st.one-line/Runtime/OneLine.Runtime.asmdef)
  1. Also, for test-assemblies wasn't turned on "Test assembly" flag

Expected:

  1. Importing without errors
  2. "Test assembly" flag turned on for test assemblies

Additional context
For me solution of this problem was manual updating links in *.asmdef files from GUIDs to relative paths. For example, for OneLine.Runtime.asmdef change:

{
  "name": "st.one-line.Runtime",
  "references": [
    "GUID:73c70a6eb6b6f444c878926f743350f6"
  ]
}

to

{
  "name": "st.one-line.Runtime",
  "references": [
        "st.rect-ex.Runtime"
  ]
}

Can this fix be used for plugin? Will it be compatible with UPM on 2019+ version of Unity / Asset store installation?

Add an ability to draw properties with different heights.

There are multiple reasons:

  • Draw builtin Multiline types with builtin drawers. I mean Matrix, Rect, Bounds, etc.
  • Draw [Expandable] without separate window (see task below);
  • Draw complex fields into a multiple lines (don't know how to do it, but it is very intresting feature);

OneLine can't initialize Inspector Window Utility and Naughty Attributes Errors

General Info
OS: Windows 10 pro version 1903 build 18362.418
Unity Version: 2019.2.4f1
OneLine Version: 0.5.0 according to package manager. Pretty sure I just pointed the manifest at the master git branch
OneLine Installation: Git pointing at master
RectEx Version: # only if changed manually ...no?


Describe the bug
Not sure what this error means, but Oneline isn't showing the full text of the headers, and the message said to report the error, so, here goes.

Code Example

[SerializeField, ReorderableList]
List<MyKVP> RulesTemplate = new List<MyKVP>();

[System.Serializable]
public struct MyKVP
{
    [SerializeField, OneLine.OneLineWithHeader]
    public Key key;
    [SerializeField, OneLine.OneLineWithHeader]
    public Value value; 
}   [System.Serializable]
public struct Key
{
    public enum Use { GameState, Menu, GameState_And_Menu }
    public Use use;
    [ShowIf("SetIsGameState")]
    public CustomGCOTypes.GameState gameState;
    [ShowIf("SetIsMenu")]
    public bool Menu;
    public bool SetIsGameState() => use == Use.GameState || use == Use.GameState_And_Menu;
    public bool SetIsMenu() => use == Use.Menu || use == Use.GameState_And_Menu;
    //public bool SetIsGameStateAndMenu() => use == Use.GameState_And_Menu;
}

[System.Serializable]
public struct Value
{
    public enum Set { Movement, EnableInput, Movement_And_EnableInput}
    public Set toSet;
    [HideIf("SetIsEnableInput")]
    public CustomGCOTypes.MovementState movementState;
    [HideIf("SetIsMovement")]
    public bool EnableInputs;
    bool SetIsMovement() => toSet == Set.Movement;
    bool SetIsEnableInput() => toSet == Set.EnableInput;
    bool SetIsMovementAndEnableInput() => toSet == Set.Movement_And_EnableInput;
}

Screenshots
If applicable, add screenshots to help explain your problem.
image

Additional context
Also, as a minor detail, Oneline doesn't seem to care about the drawing conditions from the NaughtyAttributes pakage defining wether or not to show fields. Not sure if this is an issue with one line or with naughty attributes, but figured I would mention it. I tried removing the ShowIf() HideIf() and Reordorable attributes though and got a similar error, so I don't think it is causing the message.

Full Error Msg

OneLine can not initialize Inspector Window Utility. 
You may experience some performance issues. 
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it.

System.NullReferenceException: Object reference not set to an instance of an object
  at OneLine.InspectorUtil.Initialize () [0x00011] in F:\WorkingDevelopment\Repositories\Rogue-Trial\Rogue-Trial\Rogue Trial\Library\PackageCache\st.one-line@c7e88cdd50f3662dc2632b3951afbd8c987e1f11\Editor\Scripts\Utils\InspectorUtil.cs:51 
  at OneLine.InspectorUtil..ctor () [0x00045] in F:\WorkingDevelopment\Repositories\Rogue-Trial\Rogue-Trial\Rogue Trial\Library\PackageCache\st.one-line@c7e88cdd50f3662dc2632b3951afbd8c987e1f11\Editor\Scripts\Utils\InspectorUtil.cs:41 
UnityEngine.Debug:LogError(Object)
OneLine.InspectorUtil:.ctor() (at Library/PackageCache/st.one-line@c7e88cdd50f3662dc2632b3951afbd8c987e1f11/Editor/Scripts/Utils/InspectorUtil.cs:45)
OneLine.OneLinePropertyDrawer:.ctor() (at Library/PackageCache/st.one-line@c7e88cdd50f3662dc2632b3951afbd8c987e1f11/Editor/Scripts/OneLinePropertyDrawer.cs:36)
UnityEditor.EditorGUI:GetPropertyHeight(SerializedProperty)
NaughtyAttributes.Editor.<>c__DisplayClass2_0:<DrawProperty>b__2(Int32) (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs:47)
UnityEditorInternal.ReorderableList:GetElementYOffset(Int32, Int32) (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:342)
UnityEditorInternal.ReorderableList:GetElementYOffset(Int32) (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:330)
UnityEditorInternal.ReorderableList:GetListElementHeight() (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:439)
UnityEditorInternal.ReorderableList:DoLayoutList() (at C:/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:390)
NaughtyAttributes.Editor.ReorderableListPropertyDrawer:DrawProperty(SerializedProperty) (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs:54)
NaughtyAttributes.Editor.InspectorEditor:DrawField(FieldInfo) (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/Editors/InspectorEditor.cs:242)
NaughtyAttributes.Editor.InspectorEditor:ValidateAndDrawField(FieldInfo) (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/Editors/InspectorEditor.cs:196)
NaughtyAttributes.Editor.InspectorEditor:OnInspectorGUI() (at Library/PackageCache/com.dbrizov.naughtyattributes@abf48092d8e608fb7340d6a447686ce0b4800709/Scripts/Editor/Editors/InspectorEditor.cs:138)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Некорректные String.Format

По всему проекту разбросано куча (порядка десятка) неправильных String.Format вида

String.Format("{1} {2}", value1, value2)

Правильно будет:

String.Format("{0} {1}", value1, value2)

Найти можно включив в решарпере отображение таких случаев как ошибок, либо прогнав через PVS Studio (так я на них собственно и наткнулся)

Slices cache fails on array resizes

  1. Take an array of dynamic arrays marked by [OneLine];
  2. Set array size to 5;
  3. set 5th element size to 5;
  4. set 4th element size to 3;
  5. set array size to 4;
  6. set array size to 5;
  7. Notify an error;

Expected: 5th element size is 4;

Actual: 5th element size is 5;

Really, 5th element size is 4, it is only visual bug.

Separate nested classes inside line.

Don't know how but now two different classes inside line joined each other and confuses customer.
Look at StandartTypesOverview.cs for examples.

InspectorUtil fails to load current Inspector window in Unity 2018

So, it looks like something is broken in 2018.3 beta.

Everything is working great in Editor, but when you try to Play, initialize error occurs.
Seems like, something goes wrong in Initialize function in Assets\OneLine\OneLine\Editor\Utils\InspectorUtil.cs

So, in order to work around I found useful to check is s_CurrentInspectorWindow really exist and in case of null return false.

So, there are some changes I've made:

       public InspectorUtil() {
            enabled = false;
            if (EditorWindow.focusedWindow is PopupWindow) return; // Detect is it [Expandable] popup

            try {
                if (this.Initialize()) // Additional check
                    enabled = true;
            }
            catch (Exception ex){
                Debug.LogError(INITIALIZATION_ERROR_MESSAGE + ex.ToString());
            }
        }

       private bool Initialize(){
            inspectorWindowType = Type.GetType(INSPECTOR_WINDOW_ASSEMBLY_QUALIFIED_NAME);

            // If this field doesn't exist, return false
            if (inspectorWindowType.GetField("s_CurrentInspectorWindow") != null) {
                window = inspectorWindowType
                .GetField("s_CurrentInspectorWindow", BindingFlags.Public | BindingFlags.Static)
                .GetValue(null);    
            } else {
                return false;
            }
            
            scrollPositionInfo = inspectorWindowType.GetField("m_ScrollPosition");
            getWindowPositionInfo = inspectorWindowType.GetProperty("position", typeof(Rect))
                                                        .GetGetMethod();

            var test = ScrollPosition;
            return true;
        }

I see that new version is coming, hope this issue would be helpful.

can not initialize Inspector Window Utility

General Info
OS: Windows 10
Unity Version: 2020.1.5 (and .1.6)
OneLine Version: Latest on Unity Store
OneLine Installation: Unity Package Manager


Describe the bug
When selecting Assets/Example/Overview/Overview.asset, this message fills the console.

OneLine can not initialize Inspector Window Utility.
You may experience some performance issues.
Please create an issue on https://github.com/slavniyteo/one-line/ and we will repair it.

System.NullReferenceException: Object reference not set to an instance of an object
at OneLine.InspectorUtil.Initialize () [0x00010] in C:\Users\noono\Documents\Unity Projects\Sulgeda\Assets\Plugins\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:51
at OneLine.InspectorUtil..ctor () [0x00039] in C:\Users\noono\Documents\Unity Projects\Sulgeda\Assets\Plugins\OneLine\OneLine\Editor\Utils\InspectorUtil.cs:41
UnityEngine.Debug:LogError(Object)
OneLine.InspectorUtil:.ctor() (at Assets/Plugins/OneLine/OneLine/Editor/Utils/InspectorUtil.cs:45)
OneLine.OneLinePropertyDrawer:.ctor() (at Assets/Plugins/OneLine/OneLine/Editor/OneLinePropertyDrawer.cs:36)
UnityEditor.Editor:DrawDefaultInspector()
EasyButtons.ObjectEditor:OnInspectorGUI() (at Assets/Plugins/EasyButtons/Assets/EasyButtons/Editor/ButtonEditor.cs:17)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

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.