I’m trying to make a class called Debug, with various special debugging functions that will be useful to my project.
well that sure didnt work, it already exists. M>y next logiccal thought then, is to try to extend/inherit from the existing one. But i’m told that debug is a sealed class
must i just select another name? i was really fond of that one.
To add to my initial post, if you are using UnityEngine, and the Debug class is in the global namespace, then there’s a good chance of receiving an ambiguous compilation error. To resolve the error, simply do as follows:
WARNING!
If you do it this way, be careful not to place using MyNamespace at the top. If you do this and you try to call Debug, the compiler won’t know which one you are trying to call. This is a perfect example of why REAL C++ coders NEVER use the directive usingnamespace std; at the top because of this very problem.
If you do implement your own class that Unity currently has as one of its classes then either remove using UnityEngine or call the namespace directly when you want to call your Debug class via MyNamespace.Debug.
to add to the suggestions of the other folks. You can also explicitly tell the compiler wich Debug version to use without typing the full qualified name all the time.
Example
using UnityEngine;
using MyNameSpace;
using Debug = MyNameSpace.Debug;
Debug.Log() // now refferes to MyNameSpace.Debug.Log()
What he means is that there is no need to panic over such a small issue because C# is not a ticking time bomb like C++. The issue can be resolved quite easily and the solution is described in the very link that you posted.