Hi to all. This is a javascript code. How i make this in unity?
var locations = [
{ name: "shops", x:3, y:4 },
{ name: "library", x:5, y:3 },
{ name: "pub", x:1, y:2 }
];
Hi to all. This is a javascript code. How i make this in unity?
var locations = [
{ name: "shops", x:3, y:4 },
{ name: "library", x:5, y:3 },
{ name: "pub", x:1, y:2 }
];
That looks like an array of arrays: `Object[][]`. I would personally do it this way though:
class Location : System.ValueType {
//In js, you have to create structs by inheriting from the above.
var name : String;
var x : float;
var y : float;
}
var locations : Location[];
try this:
var x : int;
var y : int;
var names : String;
var locations = [
{ names: "shops", x:3, y:4 },
{ names: "library", x:5, y:3 },
{ names: "pub", x:1, y:2 }
];