Forge/Integration/DataRegistry.cs
/// <summary>
/// Attempts to remove the data renderer for the given data type from the given GameObject.
/// </summary>
/// <param name="dataType">The type of data that we should remove a renderer for.</param>
/// <param name="context">The GameObject that is potentially containing the
/// renderer.</param>
Attempts to remove the data renderer for the given data type from the given GameObject.
Attempts to remove the data renderer for the given data type from the given GameObject .
public static void TryRemoveRenderer(DataAccessor dataType, GameObject context) {
            int id = dataType.Id;
            if (_renderers.ContainsKey(id)) {
                Type rendererType = _renderers[id];
                var provider = context.GetComponent(rendererType);
                if (provider != null) {
                    if (Application.isEditor) {
                        UnityEngine.Object.DestroyImmediate(provider);
                    }
                    else {
                        UnityEngine.Object.Destroy(provider);
                    }
                }
            }
        }
public static void TryRemoveRenderer ( DataAccessor dataType , GameObject context ) { int id = dataType . Id ; if ( _renderers . ContainsKey ( id ) ) { Type rendererType = _renderers [ id ] ; var provider = context . GetComponent ( rendererType ) ; if ( provider != null ) { if ( Application . isEditor ) { UnityEngine . Object . DestroyImmediate ( provider ) ; } else { UnityEngine . Object . Destroy ( provider ) ; } } } }
Attempts to remove the data renderer for the given data type from the given GameObject.
Attempts to remove the data renderer for the given data type from the given GameObject .
dataType
DataAccessor
The type of data that we should remove a renderer for.
The type of data that we should remove a renderer for .
context
GameObject
The GameObject that is potentially containing the
renderer.
The GameObject that is potentially containing the renderer .