I have 2 scripts: Console and Test. I want to call "appendLogLine" function from Test script but cannot get it working.
Console.cs:
public class ConsoleController
{
public void appendLogLine(string line)
{
if (line == "Unable to process command ''")
return;
Debug.Log(line);
if (scrollback.Count >= ConsoleController.scrollbackSize)
{
scrollback.Dequeue();
}
scrollback.Enqueue(line);
log = scrollback.ToArray();
if (logChanged != null)
{
logChanged(log);
}
}
}
Test.cs:
public GameObject ConsoleObject;
public void CallLog()
{
ConsoleObject.GetComponent<ConsoleController>.appendLogLine ("Test123");
}
I get error with that: "error CS0119: Expression denotes a method group', where avariable', value' ortype' was expected"
ConsoleObject.GetComponent<ConsoleController>().appendLogLine ("Test123");