x


custom variable type?

hi

is there a way to make custom variable type? because in some of the default components you see stuff like JointMotor and JointSpring and stuff like that. I am wondering is if there is a way make a custom one

e.g a layerMask and a GameObject in one var.

more ▼

asked Jul 10 '10 at 12:25 AM

3dDude gravatar image

3dDude
2.6k 65 76 103

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

JointMotor and JointSprint are just structs - you can't make those in javascript, but you can in c#

public struct YourStructName
{
    public GameObject go;
    public LayerMask mask;
}

In javascript, you'd have to do it as a class, which is pretty similar to a struct, but doesn't act as a value type:

class YourClassName
{
    var go : GameObject;
    var mask : LayerMask;
}
more ▼

answered Jul 10 '10 at 12:32 AM

Mike 3 gravatar image

Mike 3
30.5k 10 65 253

wow, thanks!!! works like a charm :)

Jul 10 '10 at 01:01 AM 3dDude
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3338
x2090
x109

asked: Jul 10 '10 at 12:25 AM

Seen: 1673 times

Last Updated: Jul 10 '10 at 12:25 AM