using System.Collections;
using System.Collections.Generic;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;
public class AtomController : MonoBehaviour
{
// Start is called before the first frame update
public GameObject atomPrefab;
public int atomCount = 1;
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
StartCoroutine(PlaceAtom());
}
}
private IEnumerator PlaceAtom()
{
Vector2 position = transform.position;
position.x = Mathf.Round(position.x);
position.y = Mathf.Round(position.y);
GameObject atom = Instantiate(atomPrefab, position, Quaternion.identity);
yield return atom;
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter