- Home /
Question by
melon_studio · Apr 29, 2021 at 11:19 PM ·
uiinputdistance
I'm trying to make a rhythm game based of fnf. C#
I've got all of the code set up for moving and creating the note, and I have the end goal selected. But the bit I'm stuck on is how to create a suitable range for the note. What I mean is that if the note is unreasonably far away, it won't delete the note. but if it's somewhat touching it will delete the note on input and give a grade. I've got the grading system in mind, so I just need a way to find a suitable range for the note input thing. PS working with UI elements
using UnityEngine.UI; using System.Collections; using UnityEngine;
public class NOTEPIE : MonoBehaviour { // the object to clone public GameObject Left;
// misc variables
public GameObject parentCanvas;
public GameObject LeftClone;
// Transforms
public RectTransform leftt;
// EndGoals
public GameObject LeftEnd;
void Start()
{
leftt = Left.GetComponent<RectTransform>();
var position = leftt.position;
if (1 + 7 != 2)
{ // Just to trigger
LeftClone = Instantiate(Left, position, leftt.rotation); // The parent of a moving clone
LeftClone.transform.SetParent(parentCanvas.transform);
LeftClone.tag = "Clone"; // used for destroyer
if (LeftClone)
{ // checks if leftclone exists
var LeftScript = LeftClone.GetComponent<Movement>();
LeftScript.enabled = true;
}
}
}
void Update()
{
if (Input.GetKeyDown("a"))
{
var Note = GameObject.FindGameObjectWithTag("Clone"); // Note
// this is the bit I'm stuck on. I tried the vector3.distance command with the variable above and the LeftEnd game object, then it just spitted out 14 diffrent errors that didn't make sense
}
}
}
Comment