public BIWEntity DuplicateEntity(BIWEntity entityToDuplicate) { IDCLEntity entity = SceneUtils.DuplicateEntity(sceneToEdit, entityToDuplicate.rootEntity); //Note: If the entity contains the name component or DCLLockedOnEdit, we don't want to copy them entity.RemoveSharedComponent(typeof(DCLName), false); entity.RemoveSharedComponent(typeof(DCLLockedOnEdit), false); BIWUtils.CopyGameObjectStatus(entityToDuplicate.rootEntity.gameObject, entity.gameObject, false, false); BIWEntity convertedEntity = SetupEntityToEdit(entity); NotifyEntityIsCreated(entity); EntityListChanged(); return(convertedEntity); }
public override void AttachTo(IDCLEntity entity, System.Type overridenAttachedType = null) { if (attachedEntities.Contains(entity)) { return; } entity.RemoveSharedComponent(typeof(BasicMaterial)); base.AttachTo(entity); }
public virtual void DetachFrom(IDCLEntity entity, System.Type overridenAttachedType = null) { if (!attachedEntities.Contains(entity)) { return; } entity.OnRemoved -= OnEntityRemoved; System.Type thisType = overridenAttachedType != null ? overridenAttachedType : GetType(); entity.RemoveSharedComponent(thisType, false); attachedEntities.Remove(entity); OnDetach?.Invoke(entity); }