Nejcc / UnityScripts

Helpfull unity scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnityScripts

Helpfull unity scripts

Get tag

if( hit.transform.gameObject.tag == "Interact"){
  Debug.Log("Colide with interact tile");
}

Get dropdown in inspector

public enum TileSetType {Forest,Grassland,Housing};

[SerializeField] public TileSetType tileType;

Spawn items in the world with X and z cordinats

private Dictionary<HexTile , GameObject> hexToGameObjectMap;

public void SpawnUnitAt(GameObject PlayerUnitPrefab, int q, int r)
{
  GameObject myHex = hexToGameObjectMap[GetHexAt(q,r)];
  //Spawn player in
  Instantiate(PlayerUnitPrefab, myHex.transform.position, Quaternion.identity, myHex.transform);
}

About

Helpfull unity scripts

License:MIT License


Languages

Language:C# 100.0%