An instance of type 'UnityEngine.Object' is required to access non static member 'ToString'.

Hello ! I’m creating a JS script in order to display the amount of credit on UI Text, but it say

“An instance of type
‘UnityEngine.Object’ is required to
access non static member ‘ToString’.”

private var money : argent;
public var texte : UI.Text;

function Start () {
money = GameObject.Find("_manager").GetComponent(argent);
}

function Update () {
texte.text= "C :" + argent.ToString();
}

Thx for your help !!!

@ clement010200

What does argent look like? Lets say argent.js has a property like this

public var credits : int;

then what you probably want to do is this for your Update() function

 function Update () {
     texte.text = "C :" + argent.credits.ToString();
 }

You are creating a variable called “money” with type “argent”. you want to use money.ToString(), not argent.ToString()