Skip to content

Commit

Permalink
Add a little extra information to the event drawer
Browse files Browse the repository at this point in the history
- Add the proxy behaviour type to the event drawer when showing UdonBehaviours
- Make the proxy behaviour hidden by default and make the hide option show the proxy behaviour instead of the UdonBehaviour
  • Loading branch information
MerlinVR committed Sep 9, 2020
1 parent 2567bd7 commit cc75266
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Assets/UdonSharp/Editor/Editors/EasyEventEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,12 @@ void AddFunctionToMenu(string contentPath, SerializedProperty elementProperty, F
void BuildMenuForObject(Object targetObject, SerializedProperty elementProperty, GenericMenu menu, int componentCount = 0)
{
List<FunctionData> methodInfos = new List<FunctionData>();
string contentPath = targetObject.GetType().Name + (componentCount > 0 ? string.Format("({0})", componentCount) : "") + "/";
string contentPath = targetObject.GetType().Name + (componentCount > 0 ? string.Format("({0})", componentCount) : "")
#if UDONSHARP
//+ ((targetObject is UdonSharpBehaviour udonSharpBehaviour && UdonSharpEditorUtility.IsProxyBehaviour(udonSharpBehaviour)) ? " <proxy>" : "")
+ ((targetObject is UdonBehaviour udonBehaviour && UdonSharpEditorUtility.IsUdonSharpBehaviour(udonBehaviour)) ? $" ({UdonSharpEditorUtility.GetUdonSharpBehaviourType(udonBehaviour)})" : "")
#endif
+ "/";

FindValidMethods(targetObject, PersistentListenerMode.Void, methodInfos);
FindValidMethods(targetObject, PersistentListenerMode.Int, methodInfos);
Expand Down Expand Up @@ -1340,7 +1345,13 @@ GenericMenu BuildPopupMenu(Object targetObj, SerializedProperty elementProperty,
#if UDONSHARP
if (cachedSettings.hideOriginalUdonBehaviour &&
component is UdonBehaviour udonBehaviour &&
udonBehaviour.programSource != null && udonBehaviour.programSource is UdonSharpProgramAsset)
udonBehaviour.programSource != null && udonBehaviour.programSource is UdonSharpProgramAsset &&
UdonSharpEditorUtility.FindProxyBehaviour(udonBehaviour, ProxySerializationPolicy.NoSerialization) != null)
continue;

if (!cachedSettings.hideOriginalUdonBehaviour &&
component is UdonSharpBehaviour proxyBehaviour &&
UdonSharpEditorUtility.IsProxyBehaviour(proxyBehaviour))
continue;
#endif

Expand Down

0 comments on commit cc75266

Please sign in to comment.