hello i need help, i created a touch screen for the mobile phone in unity 3d. Now I’ve encountered the problem that I keep getting this error message: “Assets\Scripts\TouchPlayer.cs(7,12): error CS0246: The type or namespace name ‘InputRing’ could not be found (are you missing a using directive or an assembly reference?)”
I don’t know what to do or how to get rid of it
public class TouchPlayer : MonoBehaviour
public InputRing input;
public InputLook look;
public float moveSpeed = 5, rotSpeed = 4;
private void Start()
ri = GetComponent<Rigidbody>();
transform.Rotate(new Vector3(0, look.dir.x * rotSpeed, 0));
ri.velocity = Vector3.zero;
Vector2 dir = input.dir;
if (dir.x != 0 || dir.y != 0) ri.AddRelativeForce(new Vector3(dir.x, 0, dir.y) * moveSpeed, ForceMode.Impulse);
else ri.velocity = Vector3.zero;
Hi @Troxxer ! That error means that the namespace that contains the InputRing class is not imported.
You must import it adding at the top of your script:
You can use your IDE to get to the InputRing class and see inside which namespace it is. Hope it helps! Don’t forget to mark the question as solved if it helped.
@Franco_Voisard Thanks for the answer! It doesn’t work. There is always the error “Assets\Scripts\TouchPlayer.cs(10,12): error CS0118: ‘InputLook and InputRing’ is a variable but is used like a type” I used the command
using NAMESPACE InputRing; and
using NAMESPACE InputLook; but unfortunately nothing happened. I don’t understand how to get rid of it. I’ve also tried the
using UnityEngine.UI; namespace. But that didn’t help either, because then an “Assets\Scripts\TouchPlayer.cs(6,1): error CS1529: A using clause must precede all other elements defined in the namespace except extern alias declarations” error message appears.