- Home /
Question by
3dDude · Jul 10, 2010 at 12:25 AM ·
gameobjectvar
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.
Comment
Best Answer
Answer by Mike 3 · Jul 10, 2010 at 12:32 AM
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;
}
Your answer
Follow this Question
Related Questions
how I can get a property of a GameObject? 2 Answers
How do I remove a GameObject var? 1 Answer
Destroy all GameObjects EXCEPT some... 2 Answers
Errors when trying to enable script on gameobject. 0 Answers