Getting vars in another script

Hi, I wonder if it is possible to get the names of (not access) the variables and functions inside a script, whiteout have looked at the source for that script.
I want to do this because i want to be able to make grass in runtime, but i cant find the variable holding the grass instances.

Thanks /Aron

I have the same problem. Who knows the answer?

Thx

Do you want to create grass to or do you just have the same problem?

PS: Does someone know if there is some FULL documentation about the terrain script?

One way to do it is:

GetComponent(OtherScript).var1;

See Unity - Scripting API: Component.GetComponent

Another would be using static variables.

Yes that way you can access them but I don’t know the names of the variables, that’s the problem

What can you do with static vars?

Oh. Misunderstood. Try looking at Unity - Scripting API: Terrain
to see what you can access and how.

Yes I know I can access that, but there is a “hidden” var in the TerainData object:
Named TreeInstances or something like that, I’m using that to generate trees at runtime, there should be a grassInstances var too, but I can’t find the name for it, I have tried with a lot o different names.
Those names aren’t highlighted in unitron so they are a little hard to find.

Hello

The variable is called detailPrototypes and is an array filled with structures of type detailPrototype. What I don’t know so far is how is that structure. I suppose it is made of something like an index to the detail mesh and a position.

Is there a way to know how an structure is defined?

You can pull apart the structure of classes using the Mono Reflection class, but this is not a task for the fainthearted :wink:

Thanks andeeee. That seems like chinese to me. :?

Maybe a couple more years developing with Unity will give me enough knowledge to understand it.

Hello. Searching the forum you will find that .Tom. already solved this problem. He sells a group of very useful Terrain tools. You will find them here…
http://web.lemuria.org/projects/wiki/TerrainTools