https://github.com/nejcc/unityscripts
Helpfull unity scripts
https://github.com/nejcc/unityscripts
Last synced: 8 months ago
JSON representation
Helpfull unity scripts
- Host: GitHub
- URL: https://github.com/nejcc/unityscripts
- Owner: Nejcc
- License: mit
- Created: 2018-12-09T20:19:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-11T19:28:37.000Z (over 7 years ago)
- Last Synced: 2025-02-25T23:32:12.723Z (over 1 year ago)
- Language: C#
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UnityScripts
Helpfull unity scripts
## Get tag
```cs
if( hit.transform.gameObject.tag == "Interact"){
Debug.Log("Colide with interact tile");
}
```
## Get dropdown in inspector
```cs
public enum TileSetType {Forest,Grassland,Housing};
[SerializeField] public TileSetType tileType;
```
## Spawn items in the world with X and z cordinats
```cs
private Dictionary 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);
}
```