Trouble Cloning Tilemaps
by John Kanalakis · in Torque X 3D · 12/24/2006 (12:00 pm) · 1 replies
I'm attempting to clone one tilemap into a new object. The source tilemap, named "SourceTiles", has no custom components attached and is designated as a Template. The simple source code looks like this:
The assertion that results looks like this:

According to the docs...
I made some code changes to the engine source code T2D/T2DTileLayers.cs by adding the [TorqueCloneIgnore] attributes to each property, but it looks like that did not work either... assertion failure is gone, but no cloning either. I don't see a specific T2DTileLayer.CopyTo() method and I'm wondering if I need to code that method into the engine code. Just wondering... is there anything more obvious that I'm missing?
T2DTileLayer newTiles;
protected override void BeginRun()
{
...
newTiles = (T2DTileLayer)((T2DTileLayer)TorqueObjectDatabase.Instance.FindObject("SourceTiles")).CloneT();
newTiles.SetPosition(new Vector2(37.0F, 2.0F), true);
...
}The assertion that results looks like this:

According to the docs...
Quote:The CopyTo method must copy all public properties not marked with the TorqueCloneIgnore attribute. If you fail to do this you will get an assert in debug mode which will tell you exactly what lines of code need to be added. You might be wondering why you have to implement the code if the program can tell you what lines of code to add.
I made some code changes to the engine source code T2D/T2DTileLayers.cs by adding the [TorqueCloneIgnore] attributes to each property, but it looks like that did not work either... assertion failure is gone, but no cloning either. I don't see a specific T2DTileLayer.CopyTo() method and I'm wondering if I need to code that method into the engine code. Just wondering... is there anything more obvious that I'm missing?
About the author
John Kanalakis is the owner of EnvyGames, an independent game development studio in Silicon Valley that produces games and tools for Xbox 360, Windows, and the Web.
Torque Owner John Quigley