public void OnInstalledObjectCreated(InstalledObject obj) { //Create a visual GameObject linked to this data //Debug.Log("OnInstalledObjectCreated"); // FIXME: No multitile objects or rotation GameObject obj_go = new GameObject(); //Add our InstalledObject GO pair to the Dictionary installedObjectGameObjectMap.Add(obj, obj_go); obj_go.name = obj.objectType + "_" + obj.tile.X + "_" + obj.tile.Y; obj_go.transform.position = new Vector3(obj.tile.X, obj.tile.Y, 0); obj_go.transform.SetParent(this.transform, true); //obj_go.layer = 11; //Add a Sprite renderer and set the sprite based off the base map. SpriteRenderer obj_sr = obj_go.AddComponent <SpriteRenderer>(); obj_sr.sprite = GetSpriteForInstalledObject(obj); obj_sr.sortingLayerName = "InstalledObjects"; //Register a callback so that the GameObject gets updated whenever the object chages obj.RegisterInstalledObjectChangedCallback(OnInstalledObjectChanged); }