Skip to content

Commit 302e25d

Browse files
committed
Update
1 parent ed104ee commit 302e25d

File tree

17 files changed

+221
-151
lines changed

17 files changed

+221
-151
lines changed

Assets/Plugins/UnityEventTracker/PersistentCalls.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Assets/Scenes/SampleScene.unity

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,77 @@ Transform:
618618
m_Father: {fileID: 0}
619619
m_RootOrder: 5
620620
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
621+
--- !u!1 &1114487108
622+
GameObject:
623+
m_ObjectHideFlags: 0
624+
m_CorrespondingSourceObject: {fileID: 0}
625+
m_PrefabInstance: {fileID: 0}
626+
m_PrefabAsset: {fileID: 0}
627+
serializedVersion: 6
628+
m_Component:
629+
- component: {fileID: 1114487110}
630+
- component: {fileID: 1114487109}
631+
m_Layer: 0
632+
m_Name: Some (1)
633+
m_TagString: Untagged
634+
m_Icon: {fileID: 0}
635+
m_NavMeshLayer: 0
636+
m_StaticEditorFlags: 0
637+
m_IsActive: 1
638+
--- !u!114 &1114487109
639+
MonoBehaviour:
640+
m_ObjectHideFlags: 0
641+
m_CorrespondingSourceObject: {fileID: 0}
642+
m_PrefabInstance: {fileID: 0}
643+
m_PrefabAsset: {fileID: 0}
644+
m_GameObject: {fileID: 1114487108}
645+
m_Enabled: 1
646+
m_EditorHideFlags: 0
647+
m_Script: {fileID: 11500000, guid: 9f16330cd6f111546b6a24fc331e652f, type: 3}
648+
m_Name:
649+
m_EditorClassIdentifier:
650+
SomeEvent:
651+
m_PersistentCalls:
652+
m_Calls:
653+
- m_Target: {fileID: 705507994}
654+
m_TargetAssemblyTypeName: UnityEngine.Light, UnityEngine
655+
m_MethodName: set_range
656+
m_Mode: 4
657+
m_Arguments:
658+
m_ObjectArgument: {fileID: 0}
659+
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
660+
m_IntArgument: 0
661+
m_FloatArgument: 0
662+
m_StringArgument:
663+
m_BoolArgument: 0
664+
m_CallState: 2
665+
- m_Target: {fileID: 1926409886}
666+
m_TargetAssemblyTypeName: Assets.Test.TestClassUsedInEvent, Assembly-CSharp
667+
m_MethodName: SomeOtherMethod
668+
m_Mode: 1
669+
m_Arguments:
670+
m_ObjectArgument: {fileID: 0}
671+
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
672+
m_IntArgument: 0
673+
m_FloatArgument: 0
674+
m_StringArgument:
675+
m_BoolArgument: 0
676+
m_CallState: 2
677+
--- !u!4 &1114487110
678+
Transform:
679+
m_ObjectHideFlags: 0
680+
m_CorrespondingSourceObject: {fileID: 0}
681+
m_PrefabInstance: {fileID: 0}
682+
m_PrefabAsset: {fileID: 0}
683+
m_GameObject: {fileID: 1114487108}
684+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
685+
m_LocalPosition: {x: 0, y: 0, z: 0}
686+
m_LocalScale: {x: 1, y: 1, z: 1}
687+
m_ConstrainProportionsScale: 0
688+
m_Children: []
689+
m_Father: {fileID: 0}
690+
m_RootOrder: 8
691+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
621692
--- !u!1 &1171403526
622693
GameObject:
623694
m_ObjectHideFlags: 0

Assets/Scripts/TestClassWithEvent.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
using System;
22
using UnityEngine;
33
using UnityEngine.Events;
4-
using UnityEventTracker.Serialization;
54

65
namespace Assets
76
{
87
public class TestClassWithEvent : MonoBehaviour
98
{
109
public UnityEvent Event;
1110
public UnityEvent<int> IntEvent;
11+
1212
[SerializeField] private Nested1 Nested1Instance;
1313

1414
private void Awake()
1515
{
1616
Event?.Invoke();
17-
Debug.Log("Here");
18-
Debug.Log(JsonUtility.ToJson(new Wrapper<DateTime>(DateTime.Now)));
1917
}
2018

2119
[Serializable]

Assets/UnityEventTracker/Scripts/Editor/Core/UnityEventHighlighter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
using System.Linq;
77
using UnityEditorInternal;
88
using UnityEngine.Events;
9-
using UnityEventTracker.Utils;
9+
using UnityEventTracker.DataClasses;
1010

1111
namespace UnityEventTracker
1212
{
1313
[InitializeOnLoad]
14-
public static class UnityEventHighlighter
14+
internal static class UnityEventHighlighter
1515
{
1616
private static readonly Type BaseUnityEventType = typeof(UnityEventBase);
1717
private static readonly FieldInfo PersistentCallsField = BaseUnityEventType.GetField("m_PersistentCalls", BindingFlags.Instance | BindingFlags.NonPublic);

Assets/UnityEventTracker/Scripts/Editor/Core/UnityEventTracker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace UnityEventTracker
1818
{
1919
[InitializeOnLoad]
20-
public static class UnityEventTracker
20+
internal static class UnityEventTracker
2121
{
2222
public static event Action OnDataChanged;
2323
public const string Name = "UnityEventTracker";

Assets/UnityEventTracker/Scripts/Editor/DataClasses/Address.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System;
22
using UnityEngine;
33

4-
namespace UnityEventTracker
4+
namespace UnityEventTracker.DataClasses
55
{
66
[Serializable]
7-
public struct Address
7+
internal struct Address
88
{
99
[SerializeField] private string _assetGuid;
1010
[SerializeField] private string _gameObjectId; // Local Id of related game object,

Assets/UnityEventTracker/Scripts/Editor/DataClasses/HierarchyItem.cs

Lines changed: 59 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,77 @@
22
using UnityEditor;
33
using UnityEventTracker.Utils;
44

5-
// Source - https://github.com/NCEEGEE/PrettyHierarchy/blob/main/Editor/HierarchyItem.cs
6-
public class HierarchyItem
5+
namespace UnityEventTracker.DataClasses
76
{
8-
public int InstanceId { get; }
9-
public bool IsSelected { get; }
10-
public bool IsHovered { get; }
11-
public GameObject GameObject { get; }
12-
public Rect BackgroundRect { get; private set; }
13-
public Rect TextRect { get; private set; }
14-
public Rect CollapseToggleIconRect { get; private set; }
15-
public Rect PrefabIconRect { get; private set; }
16-
public Rect EditPrefabIconRect { get; private set; }
7+
// Source - https://github.com/NCEEGEE/PrettyHierarchy/blob/main/Editor/HierarchyItem.cs
8+
internal class HierarchyItem
9+
{
10+
public int InstanceId { get; }
11+
public bool IsSelected { get; }
12+
public bool IsHovered { get; }
13+
public GameObject GameObject { get; }
14+
public Rect BackgroundRect { get; private set; }
15+
public Rect TextRect { get; private set; }
16+
public Rect CollapseToggleIconRect { get; private set; }
17+
public Rect PrefabIconRect { get; private set; }
18+
public Rect EditPrefabIconRect { get; private set; }
1719

18-
public Color BackgroundColor { get; set; }
20+
public Color BackgroundColor { get; set; }
1921

20-
public HierarchyItem(int instanceId, Rect selectionRect, GameObject gameObject)
21-
{
22-
InstanceId = instanceId;
23-
IsSelected = Selection.Contains(instanceId);
24-
GameObject = gameObject;
22+
public HierarchyItem(int instanceId, Rect selectionRect, GameObject gameObject)
23+
{
24+
InstanceId = instanceId;
25+
IsSelected = Selection.Contains(instanceId);
26+
GameObject = gameObject;
2527

26-
CalculateRects(selectionRect);
28+
CalculateRects(selectionRect);
2729

28-
IsHovered = BackgroundRect.Contains(Event.current.mousePosition);
30+
IsHovered = BackgroundRect.Contains(Event.current.mousePosition);
2931

30-
BackgroundColor = EditorColors.Background;
31-
}
32+
BackgroundColor = EditorColors.Background;
33+
}
3234

33-
public void UpdateRect(Rect rect)
34-
{
35-
CalculateRects(rect);
36-
}
35+
public void UpdateRect(Rect rect)
36+
{
37+
CalculateRects(rect);
38+
}
3739

38-
public void Draw()
39-
{
40-
EditorGUI.DrawRect(PrefabIconRect, BackgroundColor);
41-
}
40+
public void Draw()
41+
{
42+
EditorGUI.DrawRect(PrefabIconRect, BackgroundColor);
43+
}
4244

43-
private void CalculateRects(Rect selectionRect)
44-
{
45-
var xPos = selectionRect.position.x + 60f - 28f - selectionRect.xMin;
46-
var yPos = selectionRect.position.y;
47-
var xSize = selectionRect.size.x + selectionRect.xMin + 28f - 60 + 16f;
48-
var ySize = selectionRect.size.y;
49-
BackgroundRect = new Rect(xPos, yPos, xSize, ySize);
45+
private void CalculateRects(Rect selectionRect)
46+
{
47+
var xPos = selectionRect.position.x + 60f - 28f - selectionRect.xMin;
48+
var yPos = selectionRect.position.y;
49+
var xSize = selectionRect.size.x + selectionRect.xMin + 28f - 60 + 16f;
50+
var ySize = selectionRect.size.y;
51+
BackgroundRect = new Rect(xPos, yPos, xSize, ySize);
5052

51-
xPos = selectionRect.position.x + 18f;
52-
yPos = selectionRect.position.y;
53-
xSize = selectionRect.size.x - 18f;
54-
ySize = selectionRect.size.y;
55-
TextRect = new Rect(xPos, yPos, xSize, ySize);
53+
xPos = selectionRect.position.x + 18f;
54+
yPos = selectionRect.position.y;
55+
xSize = selectionRect.size.x - 18f;
56+
ySize = selectionRect.size.y;
57+
TextRect = new Rect(xPos, yPos, xSize, ySize);
5658

57-
xPos = selectionRect.position.x - 14f;
58-
yPos = selectionRect.position.y + 1f;
59-
xSize = 13f;
60-
ySize = 13f;
61-
CollapseToggleIconRect = new Rect(xPos, yPos, xSize, ySize);
59+
xPos = selectionRect.position.x - 14f;
60+
yPos = selectionRect.position.y + 1f;
61+
xSize = 13f;
62+
ySize = 13f;
63+
CollapseToggleIconRect = new Rect(xPos, yPos, xSize, ySize);
6264

63-
xPos = selectionRect.position.x;
64-
yPos = selectionRect.position.y;
65-
xSize = 16f;
66-
ySize = 16f;
67-
PrefabIconRect = new Rect(xPos, yPos, xSize, ySize);
65+
xPos = selectionRect.position.x;
66+
yPos = selectionRect.position.y;
67+
xSize = 16f;
68+
ySize = 16f;
69+
PrefabIconRect = new Rect(xPos, yPos, xSize, ySize);
6870

69-
xPos = BackgroundRect.xMax - 16f;
70-
yPos = selectionRect.yMin;
71-
xSize = 16f;
72-
ySize = 16f;
73-
EditPrefabIconRect = new Rect(xPos, yPos, xSize, ySize);
71+
xPos = BackgroundRect.xMax - 16f;
72+
yPos = selectionRect.yMin;
73+
xSize = 16f;
74+
ySize = 16f;
75+
EditPrefabIconRect = new Rect(xPos, yPos, xSize, ySize);
76+
}
7477
}
7578
}

Assets/UnityEventTracker/Scripts/Editor/DataClasses/PersistentCall.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using UnityEditor;
33
using UnityEngine;
44
using UnityEngine.Events;
5-
using UnityEventTracker.Utils;
65

76
namespace UnityEventTracker.DataClasses
87
{

Assets/UnityEventTracker/Scripts/Editor/DataClasses/YAMLObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
using System.Text;
44

5-
namespace UnityEventTracker
5+
namespace UnityEventTracker.DataClasses
66
{
77
internal readonly struct YAMLObject
88
{

Assets/UnityEventTracker/Scripts/Editor/Serialization/SerializableHashSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace UnityEventTracker.Serialization
88
{
9-
public class SerializableHashSet<TArgs> : IEnumerable<TArgs>
9+
internal class SerializableHashSet<TArgs> : IEnumerable<TArgs>
1010
{
1111
public string Name { get; }
1212
public string RootPath { get; }

0 commit comments

Comments
 (0)