Alright so here’s the situation, in my namespace, I’m trying to include the System.Collections namespace
The problem is when I try typing it in at the top, Visual Studio tells me using System.Collections Using Directive is unnecessary. both before and after I type in the code(and closing it and opening it again)
Visual Studio still tells me it’s unnecessary and the print statement causes errors treating it like System.Collections was never included.
public class XTextBasic
private bool createOnce = true;
private string gtnlaatRval = "";
private int count = 0;
public string getTextNLettersAtATime(string Str,float delay,int n = 1, int startval = 0)
gtnlaatRval = "";
createOnce = false;
count = startval;
gtnlaatRval = Str.Substring(startval, count);
Thanks in advance.
To answer the OP question: What exact class from the System.Collections namespace do you want to use? You don’t seem to be using any class from that namespace therefore it’s unnecessary. Though it certainly doesn’t hurt. VS just tells you that you could remove it.
I think your main problem here is that you try to use “print” which is actually a method that is defined inside the MonoBehaviour class. Your class doesn’t derive from MonoBehaviour and therefore there is no “print” method. However “print” is just a wrapper for “Debug.Log”. Personally i never use print, i always use Debug.Log which works everywhere. If you really want to use print for some reason you have to use:
MonoBehaviour.print(). That can’t be shorten anymore since MonoBehaviour is a class and methods can’t be declared in a namespace, only inside a class.
You said you have the same problem but that doesn’t seem to be the case. Putting a
using UnityEngine.SceneManagement; at the top will allow you to simply use
SceneManager.LoadScene(0); in your code. If you want us to actually have a look at your case, ask your own question. If you do make sure you post your actual code that isn’t working.
I’m afraid I resolved this issue long enough ago that I remember nearly nothing about it.
thank you all the same.