I have a class that I am using as my extension:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public static class Extensions {
/// <summary>
/// Converts a list to a string
/// </summary>
public static string ConvertToString(this List<object> list)
{
var output = string.Empty;
foreach (var item in list)
{
output += item.ToString() + ",";
}
return output;
}
}
This is inside a folder called General Scripts.
In another folder called GUI Scripts I have a class that is trying to access this class.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Cube_GesturePreference : MonoBehaviour {
string[] gestureOptions = { Cube_DemoPhase.selection.ConvertToString(),
Cube_DemoPhase.selection.ConvertToString(),
Cube_DemoPhase.selection.ConvertToString()
};
public void Start(){}
public void Update(){}
}
But it gives me this error:
Error 2 Instance argument: cannot convert from 'System.Collections.Generic.List<string>' to 'System.Collections.Generic.List<object>'
Error 1 'System.Collections.Generic.List<string>' does not contain a definition for 'ConvertToString' and the best extension method overload 'Extensions.ConvertToString(System.Collections.Generic.List<object>)' has some invalid arguments
Can anyone help me figure out why my extension method is not showing up when I try to access it?