using JetBrains.Annotations; using System.Collections.Generic; using UdonSharp; using UnityEditor; using UnityEngine; using VRC.Udon; namespace UdonSharpEditor { public static class UdonSharpComponentExtensions { #region Serialization Helper extensions /// /// Updates the proxy representation from the underlying UdonBehaviour state /// /// [PublicAPI] public static void UpdateProxy(this UdonSharpBehaviour behaviour) { UdonSharpEditorUtility.CopyUdonToProxy(behaviour); } /// /// Updates the proxy representation from the underlying UdonBehaviour state /// /// /// [PublicAPI] public static void UpdateProxy(this UdonSharpBehaviour behaviour, ProxySerializationPolicy serializationPolicy) { UdonSharpEditorUtility.CopyUdonToProxy(behaviour, serializationPolicy); } /// /// Writes changes to the proxy's data to the underlying UdonBehaviour /// /// [PublicAPI] public static void ApplyProxyModifications(this UdonSharpBehaviour behaviour) { UdonSharpEditorUtility.CopyProxyToUdon(behaviour); } /// /// Writes changes to the proxy's data to the underlying UdonBehaviour /// /// /// [PublicAPI] public static void ApplyProxyModifications(this UdonSharpBehaviour behaviour, ProxySerializationPolicy serializationPolicy) { UdonSharpEditorUtility.CopyProxyToUdon(behaviour, serializationPolicy); } #endregion #region Utility functions private static UdonSharpBehaviour ConvertToUdonSharpComponentIntnl(UdonBehaviour behaviour, System.Type type, ProxySerializationPolicy proxySerializationPolicy) { if (behaviour == null) return null; if (!UdonSharpEditorUtility.IsUdonSharpBehaviour(behaviour)) return null; UdonSharpBehaviour udonSharpBehaviour = UdonSharpEditorUtility.GetProxyBehaviour(behaviour, ProxySerializationPolicy.NoSerialization); System.Type uSharpBehaviourType = udonSharpBehaviour.GetType(); if (udonSharpBehaviour && (uSharpBehaviourType == type || uSharpBehaviourType.IsSubclassOf(type))) { UdonSharpEditorUtility.CopyUdonToProxy(udonSharpBehaviour, proxySerializationPolicy); return udonSharpBehaviour; } return null; } private static UdonSharpBehaviour ConvertToUdonSharpComponent(UdonBehaviour[] behaviours, System.Type type, ProxySerializationPolicy proxySerializationPolicy) { foreach (UdonBehaviour behaviour in behaviours) { UdonSharpBehaviour udonSharpBehaviour = ConvertToUdonSharpComponentIntnl(behaviour, type, proxySerializationPolicy); if (udonSharpBehaviour) return udonSharpBehaviour; } return null; } private static T ConvertToUdonSharpComponent(UdonBehaviour[] behaviours, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour { return (T)ConvertToUdonSharpComponent(behaviours, typeof(T), proxySerializationPolicy); } private static UdonSharpBehaviour[] ConvertToUdonSharpComponents(UdonBehaviour[] behaviours, System.Type type, ProxySerializationPolicy proxySerializationPolicy) { if (behaviours.Length == 0) return new UdonSharpBehaviour[0]; List udonSharpBehaviours = new List(); foreach (UdonBehaviour behaviour in behaviours) { UdonSharpBehaviour udonSharpBehaviour = ConvertToUdonSharpComponentIntnl(behaviour, type, proxySerializationPolicy); if (udonSharpBehaviour) udonSharpBehaviours.Add(udonSharpBehaviour); } return udonSharpBehaviours.ToArray(); } private static T[] ConvertToUdonSharpComponents(UdonBehaviour[] behaviours, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour { if (behaviours.Length == 0) return new T[0]; List udonSharpBehaviours = new List(); foreach (UdonBehaviour behaviour in behaviours) { UdonSharpBehaviour udonSharpBehaviour = ConvertToUdonSharpComponentIntnl(behaviour, typeof(T), proxySerializationPolicy); if (udonSharpBehaviour) udonSharpBehaviours.Add((T)udonSharpBehaviour); } return udonSharpBehaviours.ToArray(); } #endregion #region AddComponent [PublicAPI] public static UdonSharpBehaviour AddUdonSharpComponent(this GameObject gameObject, System.Type type) { if (type == typeof(UdonSharpBehaviour)) throw new System.ArgumentException("Cannot add components of type 'UdonSharpBehaviour', you can only add subclasses of this type"); if (!typeof(UdonSharpBehaviour).IsAssignableFrom(type)) throw new System.ArgumentException("Type for AddUdonSharpComponent must be a subclass of UdonSharpBehaviour"); UdonBehaviour udonBehaviour = gameObject.AddComponent(); UdonSharpProgramAsset programAsset = UdonSharpProgramAsset.GetProgramAssetForClass(type); udonBehaviour.programSource = programAsset; #pragma warning disable CS0618 // Type or member is obsolete udonBehaviour.SynchronizePosition = false; udonBehaviour.AllowCollisionOwnershipTransfer = false; #pragma warning restore CS0618 // Type or member is obsolete udonBehaviour.Reliable = programAsset.behaviourSyncMode == BehaviourSyncMode.Manual; SerializedObject componentAsset = new SerializedObject(udonBehaviour); SerializedProperty serializedProgramAssetProperty = componentAsset.FindProperty("serializedProgramAsset"); serializedProgramAssetProperty.objectReferenceValue = programAsset.SerializedProgramAsset; componentAsset.ApplyModifiedPropertiesWithoutUndo(); UdonSharpBehaviour proxyComponent = UdonSharpEditorUtility.GetProxyBehaviour(udonBehaviour); if (EditorApplication.isPlaying) udonBehaviour.InitializeUdonContent(); return proxyComponent; } [PublicAPI] public static T AddUdonSharpComponent(this GameObject gameObject) where T : UdonSharpBehaviour => (T)AddUdonSharpComponent(gameObject, typeof(T)); #endregion #region GetComponent [PublicAPI] public static T GetUdonSharpComponent(this GameObject gameObject) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(gameObject.GetComponents(), ProxySerializationPolicy.Default); [PublicAPI] public static T GetUdonSharpComponent(this GameObject gameObject, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(gameObject.GetComponents(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponent(this GameObject gameObject, System.Type type) => ConvertToUdonSharpComponent(gameObject.GetComponents(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponent(this GameObject gameObject, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponent(gameObject.GetComponents(), type, proxySerializationPolicy); [PublicAPI] public static T GetUdonSharpComponent(this Component component) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(component.GetComponents(), ProxySerializationPolicy.Default); [PublicAPI] public static T GetUdonSharpComponent(this Component component, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(component.GetComponents(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponent(this Component component, System.Type type) => ConvertToUdonSharpComponent(component.GetComponents(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponent(this Component component, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponent(component.GetComponents(), type, proxySerializationPolicy); #endregion #region GetComponents [PublicAPI] public static T[] GetUdonSharpComponents(this GameObject gameObject) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponents(), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponents(this GameObject gameObject, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponents(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponents(this GameObject gameObject, System.Type type) => ConvertToUdonSharpComponents(gameObject.GetComponents(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponents(this GameObject gameObject, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(gameObject.GetComponents(), type, proxySerializationPolicy); [PublicAPI] public static T[] GetUdonSharpComponents(this Component component) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponents(), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponents(this Component component, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponents(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponents(this Component component, System.Type type) => ConvertToUdonSharpComponents(component.GetComponents(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponents(this Component component, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(component.GetComponents(), type, proxySerializationPolicy); #endregion #region GetComponentInChildren [PublicAPI] public static T GetUdonSharpComponentInChildren(this GameObject gameObject) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(gameObject.GetComponentsInChildren(), ProxySerializationPolicy.Default); [PublicAPI] public static T GetUdonSharpComponentInChildren(this GameObject gameObject, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(gameObject.GetComponentsInChildren(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInChildren(this GameObject gameObject, System.Type type) => ConvertToUdonSharpComponent(gameObject.GetComponentsInChildren(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInChildren(this GameObject gameObject, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponent(gameObject.GetComponentsInChildren(), type, proxySerializationPolicy); [PublicAPI] public static T GetUdonSharpComponentInChildren(this GameObject gameObject, bool includeInactive) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(gameObject.GetComponentsInChildren(includeInactive), ProxySerializationPolicy.Default); [PublicAPI] public static T GetUdonSharpComponentInChildren(this GameObject gameObject, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(gameObject.GetComponentsInChildren(includeInactive), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInChildren(this GameObject gameObject, System.Type type, bool includeInactive) => ConvertToUdonSharpComponent(gameObject.GetComponentsInChildren(includeInactive), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInChildren(this GameObject gameObject, System.Type type, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponent(gameObject.GetComponentsInChildren(includeInactive), type, proxySerializationPolicy); [PublicAPI] public static T GetUdonSharpComponentInChildren(this Component component) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(component.GetComponentsInChildren(), ProxySerializationPolicy.Default); [PublicAPI] public static T GetUdonSharpComponentInChildren(this Component component, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(component.GetComponentsInChildren(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInChildren(this Component component, System.Type type) => ConvertToUdonSharpComponent(component.GetComponentsInChildren(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInChildren(this Component component, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponent(component.GetComponentsInChildren(), type, proxySerializationPolicy); [PublicAPI] public static T GetUdonSharpComponentInChildren(this Component component, bool includeInactive) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(component.GetComponentsInChildren(includeInactive), ProxySerializationPolicy.Default); [PublicAPI] public static T GetUdonSharpComponentInChildren(this Component component, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(component.GetComponentsInChildren(includeInactive), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInChildren(this Component component, System.Type type, bool includeInactive) => ConvertToUdonSharpComponent(component.GetComponentsInChildren(includeInactive), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInChildren(this Component component, System.Type type, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponent(component.GetComponentsInChildren(includeInactive), type, proxySerializationPolicy); #endregion #region GetComponentsInChildren [PublicAPI] public static T[] GetUdonSharpComponentsInChildren(this GameObject gameObject) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponentsInChildren(), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponentsInChildren(this GameObject gameObject, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponentsInChildren(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInChildren(this GameObject gameObject, System.Type type) => ConvertToUdonSharpComponents(gameObject.GetComponentsInChildren(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInChildren(this GameObject gameObject, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(gameObject.GetComponentsInChildren(), type, proxySerializationPolicy); [PublicAPI] public static T[] GetUdonSharpComponentsInChildren(this GameObject gameObject, bool includeInactive) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponentsInChildren(includeInactive), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponentsInChildren(this GameObject gameObject, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponentsInChildren(includeInactive), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInChildren(this GameObject gameObject, System.Type type, bool includeInactive) => ConvertToUdonSharpComponents(gameObject.GetComponentsInChildren(includeInactive), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInChildren(this GameObject gameObject, System.Type type, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(gameObject.GetComponentsInChildren(includeInactive), type, proxySerializationPolicy); [PublicAPI] public static T[] GetUdonSharpComponentsInChildren(this Component component) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponentsInChildren(), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponentsInChildren(this Component component, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponentsInChildren(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInChildren(this Component component, System.Type type) => ConvertToUdonSharpComponents(component.GetComponentsInChildren(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInChildren(this Component component, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(component.GetComponentsInChildren(), type, proxySerializationPolicy); [PublicAPI] public static T[] GetUdonSharpComponentsInChildren(this Component component, bool includeInactive) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponentsInChildren(includeInactive), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponentsInChildren(this Component component, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponentsInChildren(includeInactive), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInChildren(this Component component, System.Type type, bool includeInactive) => ConvertToUdonSharpComponents(component.GetComponentsInChildren(includeInactive), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInChildren(this Component component, System.Type type, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(component.GetComponentsInChildren(includeInactive), type, proxySerializationPolicy); #endregion #region GetComponentInParent [PublicAPI] public static T GetUdonSharpComponentInParent(this GameObject gameObject) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(gameObject.GetComponentsInParent(), ProxySerializationPolicy.Default); [PublicAPI] public static T GetUdonSharpComponentInParent(this GameObject gameObject, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(gameObject.GetComponentsInParent(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInParent(this GameObject gameObject, System.Type type) => ConvertToUdonSharpComponent(gameObject.GetComponentsInParent(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInParent(this GameObject gameObject, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponent(gameObject.GetComponentsInParent(), type, proxySerializationPolicy); [PublicAPI] public static T GetUdonSharpComponentInParent(this Component component) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(component.GetComponentsInParent(), ProxySerializationPolicy.Default); [PublicAPI] public static T GetUdonSharpComponentInParent(this Component component, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponent(component.GetComponentsInParent(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInParent(this Component component, System.Type type) => ConvertToUdonSharpComponent(component.GetComponentsInParent(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour GetUdonSharpComponentInParent(this Component component, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponent(component.GetComponentsInParent(), type, proxySerializationPolicy); #endregion #region GetComponentsInParent [PublicAPI] public static T[] GetUdonSharpComponentsInParent(this GameObject gameObject) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponentsInParent(), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponentsInParent(this GameObject gameObject, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponentsInParent(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInParent(this GameObject gameObject, System.Type type) => ConvertToUdonSharpComponents(gameObject.GetComponentsInParent(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInParent(this GameObject gameObject, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(gameObject.GetComponentsInParent(), type, proxySerializationPolicy); [PublicAPI] public static T[] GetUdonSharpComponentsInParent(this GameObject gameObject, bool includeInactive) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponentsInParent(includeInactive), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponentsInParent(this GameObject gameObject, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(gameObject.GetComponentsInParent(includeInactive), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInParent(this GameObject gameObject, System.Type type, bool includeInactive) => ConvertToUdonSharpComponents(gameObject.GetComponentsInParent(includeInactive), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInParent(this GameObject gameObject, System.Type type, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(gameObject.GetComponentsInParent(includeInactive), type, proxySerializationPolicy); [PublicAPI] public static T[] GetUdonSharpComponentsInParent(this Component component) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponentsInParent(), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponentsInParent(this Component component, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponentsInParent(), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInParent(this Component component, System.Type type) => ConvertToUdonSharpComponents(component.GetComponentsInParent(), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInParent(this Component component, System.Type type, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(component.GetComponentsInParent(), type, proxySerializationPolicy); [PublicAPI] public static T[] GetUdonSharpComponentsInParent(this Component component, bool includeInactive) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponentsInParent(includeInactive), ProxySerializationPolicy.Default); [PublicAPI] public static T[] GetUdonSharpComponentsInParent(this Component component, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) where T : UdonSharpBehaviour => ConvertToUdonSharpComponents(component.GetComponentsInParent(includeInactive), proxySerializationPolicy); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInParent(this Component component, System.Type type, bool includeInactive) => ConvertToUdonSharpComponents(component.GetComponentsInParent(includeInactive), type, ProxySerializationPolicy.Default); [PublicAPI] public static UdonSharpBehaviour[] GetUdonSharpComponentsInParent(this Component component, System.Type type, bool includeInactive, ProxySerializationPolicy proxySerializationPolicy) => ConvertToUdonSharpComponents(component.GetComponentsInParent(includeInactive), type, proxySerializationPolicy); #endregion } }