I can't wrap my head around this warning, and I'm not sure if it's actually important but I'm trying to find out. I've scoured the forums and couldn't find a solution that works in my case, though it's likely that's due to my lack of understanding of the issue. From what I understand, the error is usually caused when referencing the containing class when declaring a variable, but this class doesn't reference itself.
Capitalization/renaming was mentioned a bunch but if I rename the struct I need to rename the list, etc, so that doesn't work as a solution.
----------
Any help pointing me towards a solution would be seriously appreciated, everything in the project works fine but having warnings is never a nice thing, especially without understanding them.
Here's the warning and the class throwing the errors:
----------
> 'The type 'DevShortcutItem' in '/Users/Orion/Game Development/Parabola/Assets/Parabola/Code/Developer/DevShortcutDisplay.cs' conflicts with the imported type 'DevShortcutItem' in 'Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in '/Users/Orion/Game Development/Parabola/Assets/Parabola/Code/Developer/DevShortcutDisplay.cs'. [Assembly-CSharp-Editor]'
----------
public class DevShortcutDisplay : MonoBehaviour
{
// Some Other Variables
public List Shortcuts = new List();
Rect windowRect = new Rect(80, 55, 250, 240);
List shortcutString;
void Start()
{
shortcutString = new List();
foreach (DevShortcutItem item in Shortcuts)
{
shortcutString.Add(Reveal + " + '" + item.Key + "' to " + item.Description);
}
}
void OnGUI()
{
GUI.backgroundColor = Color.black;
if (!HiddenByDefault || Input.GetKey(Reveal))
{
GUI.skin.font = DefaultFont;
windowRect = GUILayout.Window(0, windowRect, CreateWindow, "Shortcuts");
}
}
void CreateWindow(int windowID)
{
for (int i = 0; i < Shortcuts.Count; i++)
{
if (Input.GetKey(Shortcuts[i].Key))
{
GUI.skin.font = HighlightFont;
GUILayout.Label(shortcutString[i]);
Shortcuts[i].Event.Invoke();
}
else
{
GUI.skin.font = DefaultFont;
GUILayout.Label(shortcutString[i]);
}
}
}
}
[Serializable]
public struct DevShortcutItem
{
public KeyCode Key;
public string Description;
public UnityEvent Event;
}
↧