- Home /
Question by
Carnifex12 · Dec 08, 2014 at 01:21 PM ·
gameobjectstring
Reference an object's name in a string?
So if I have an object and a string :
public var mainName : String = "John";
public var string = "";
I want to use the name in the string, I've tried this:
string = mainName + "was walking down the street.";
But that doesn't work, how can I do this?
Comment
try rena$$anonymous$$g 'string' on the second line because it's conflicting with the class name 'string'
also, I just noticed, on the first line use 'String' with lowercase 's'
and include a space before the second string in the addition
Answer by jdog98 · Dec 08, 2014 at 04:53 PM
I think its case sensitive. Your using stirng for a name, but string is a type. try using
public var String = "";
or
public var String : string;
Your answer
