Class MyComponentBase
  
  
  
  
    Inheritance
    System.Object
    MyComponentBase
      
   
  
  Assembly: VRage.Game.dll
  Syntax
  
    public abstract class MyComponentBase : Object, IMyComponentBase
   
  Constructors
  
  
  
  
  MyComponentBase()
  
  
  Declaration
  
    protected MyComponentBase()
   
  Properties
  
  
  
  
  ContainerBase
  This cannot be named Container to not conflict with the definition of Container in MyEntityComponentBase.
Declaration
  
    public IMyComponentContainer ContainerBase { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | VRage.Game.Components.Interfaces.IMyComponentContainer |  | 
    
  
  
  
  
  RemoveExistingComponentOnNewInsert
  
  
  Declaration
  
    public bool RemoveExistingComponentOnNewInsert { get; set; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  Methods
  
  
  
  
  Deserialize(MyObjectBuilder_ComponentBase)
  
  
  Declaration
  
    public virtual void Deserialize(MyObjectBuilder_ComponentBase builder)
   
  Parameters
  
  
  
  
  GetAs<T>()
  
  
  Declaration
  
    public virtual T GetAs<T>()
    where T : class
   
  Returns
  
  Type Parameters
  
  
  
  
  Init(MyComponentDefinitionBase)
  
  
  Declaration
  
    public virtual void Init(MyComponentDefinitionBase definition)
   
  Parameters
  
  
  
  
  IsSerialized()
  Tells the component container serializer whether this component should be saved
Declaration
  
    public virtual bool IsSerialized()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  OnAddedToContainer()
  Gets called after the container of this component changes
Declaration
  
    public virtual void OnAddedToContainer()
   
  
  
  
  OnAddedToScene()
  CH: TOOD: Be careful! This does not get called if the component is added to a container that is in the scene already!
Declaration
  
    public virtual void OnAddedToScene()
   
  
  
  
  OnBeforeRemovedFromContainer()
  Gets called before the removal of this component from a container
Declaration
  
    public virtual void OnBeforeRemovedFromContainer()
   
  
  
  
  OnRemovedFromScene()
  CH: TOOD: Be careful! This does not get called if the component is removed from a container that is still in the scene!
Declaration
  
    public virtual void OnRemovedFromScene()
   
  
  
  
  Serialize(Boolean)
  
  
  Declaration
  
    public virtual MyObjectBuilder_ComponentBase Serialize(bool copy = false)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Boolean | copy |  | 
    
  
  Returns
  
  
  
  
  SetContainer(IMyComponentContainer)
  Sets the container of this component.
Note that the component is not added to the container here! Therefore, use MyComponentContainer.Add(...) method and it
will in turn call this method. Actually, you should seldom have the need to call this method yourself.
Declaration
  
    public virtual void SetContainer(IMyComponentContainer container)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | VRage.Game.Components.Interfaces.IMyComponentContainer | container | The new container of the component |