- Home /
Question by
raul corrales · Mar 20, 2011 at 08:37 PM ·
javascriptobjectcreate
How I can create a Javascript object in a unity Script?
The examples that i've saw are well:
function office(city, country) {
this.city = city;
this.country = country;
}
This code, not works in Unity. The error is: city is not a member of MyScript
How I can create an object correctly?
TNX IN ADVANCE
Comment
Best Answer
Answer by Jessy · Mar 20, 2011 at 08:41 PM
For that, you'd need to name the script office, and add the variables to the class.
var city; var country;
function office (city, country) { this.city = city; this.country = country; }
Your answer
Follow this Question
Related Questions
Create an Object at a X,Y,Z location on the fly 1 Answer
Disable GameObject Only Father Not Children 2 Answers
Setting a variable to an instantiated object. 1 Answer
touch 3d object open gui 1 Answer
Drawing a 3D object javascipt 0 Answers