I am trying to declare a Quad in a script and having a (ridiculous) time of it.
// This doesn’t work.
Quad myQuad;
// This doesn’t work.
PrimitiveType.Quad myQuad;
Help Mr. Wizard!
I am trying to declare a Quad in a script and having a (ridiculous) time of it.
// This doesn’t work.
Quad myQuad;
// This doesn’t work.
PrimitiveType.Quad myQuad;
Help Mr. Wizard!
There is no Quad type; what you want is a GameObject with a quad mesh and a mesh renderer, which you can do by using CreatePrimitive.
–Eric
Eric,
Thanks for you insight.
Now, what if I don’t want to create a quad, but just want a quad reference to use later (e.g. when I use GetComponent to get a quad that is a child of an object in my scene).
GameObject myQuad;
myQuad= myObject.mySprite.GetComponent(“Quad”);
How would I do this?
– Paul
A quad isn’t a component, it’s a GameObject with a mesh (in the shape of a quad) and a mesh renderer. How you reference it depends on what specifically you want to reference. There’s actually nothing at all special or inherently quad-y about a quad…to put it another way, the only difference between a quad and a cube is that a cube has a different mesh. They’re made of exactly the same components. If you’re just referencing the GameObject, then “GameObject myQuad” is fine. You can use GameObject.Find or a public variable in the inspector or whatever.
–Eric
Eric,
So if I get a reference to a quad using GameObject.Find()
would I need to look at the mesh to find the corner points?
I’m looking to use a quad to define a sort of pseudo-collision outline on other objects.
It will really be used for spacing objects.
– Paul
No need to look at the mesh; you can use the bounds of the renderer.
–Eric
Eric,
Thanks a bunch.
As usual, you were right on the money.
You must realize that in my head you have taken on the moniker of, “Mr. Wizard”.
That really dates me, but them’s the breaks.
I appreciate all your knowledge and help.
– Paul