Ok guys, I put together some code and it works…
It created the cone object and stores it in my array…
adds it like this…
Transform clone = Instantiate(_worldobjectmanager.PrefabBaseBlock, transform.position,transform.rotation) as Transform;
clone.transform.position = transform.position + new Vector3 (i + _worldobjectmanager.MapOffSet,0, j + _worldobjectmanager.MapOffSet);
clone.parent = _gameparent;
MapBlock myblock = new MapBlock();
myblock.transform = clone;
_worldobjectmanager.MapBlocks.Add(myblock);
the list class object
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MapEditor
{
public class MapBlock : IEquatable<MapEditor.MapBlock>{
private Transform _transform;
public Transform transform{
get{return _transform; }
set{_transform = transform; }
}
public bool Equals (MapBlock other)
{
throw new NotImplementedException ();
}
public enum BlockType : byte
{
Ground= 0,
Stone = 1,
Water = 99
}
}
}
then i try to remove it like this…
public void ClearTerrain(){
foreach (MapBlock myblock in _worldobjectmanager.MapBlocks)
{
Destroy(myblock.transform.gameObject);
}
}
But it does not remove…
any one have any idea what I am doing wrong ?