Change a tile from one tilemap to another tilemap

What I am trying to do is to make a gun that shoots projectiles (already done that) that turn tiles from tilemap A to tiles from tilemap B which have different characteristics, such as letting a player go through them or not and having different alpha values to visually differentiate them.

I have searched online if there was a way to do what I want but I failed to find an answer, because I want the same tile (as in the same design) to be seen without needing to manually say which tile to use, unlike the answers where a tile is deleted by turning it to a null tile. (like here)

Alternatively it would also help me if there was a way to change the layer and alpha value of a single tile inside a tilemap, because that is what I am trying to achieve with a (probably) more complicated method.

Thanks in advance!

Changing a tile from tilemap A to B could be done using GetTile() and SetTile(), which are both TileMap functions.

public Tilemap mapA; //retrieve this by code or drag the tilemap in the inspector.
public Tilemap mapB;

public void ChangeTile(Vector3Int position) {
     Tile storeTile = mapA.GetTile(position); // Or use the TileBase class if it could be a rule tile
     mapB.SetTile(position, storeTile)
}

However, it might indeed be easier to just change the properties of a tile within a tilemap, since this gives more flexibility if there will be even more than two states that a Tile could be in when you expand your game later on.

For instance, you could use myTile.color = new Color(1,1,1,newAlphaValue); to change the alpha value of a tile (which has been retrieved using mapA.GetTile(position);). Make sure that you set the correct myTile.TileFlags so that the color isn’t locked. More documentation about the unity tiles can be found here: Unity - Scripting API: Tile


Finally, I found an interesting tutorial a while back about the changing properties beyond the properties of the Tile class using scriptable objects that might be worth checking out: How to store data in tiles (Unity Tilemap + Scriptable Objects) - YouTube