Automatic scripting define symbol creation for assets

Question: Is it possible to have the scripting define symbols created depending on files/folders?

Example: My Vegetation Studio Pro Extensions support automatic river creation using R.A.M. … But for this to work I ask the users to create a dedicated scripting define symbol, so that the R.A.M. libraries can get loaded and no compiler errors occur when the asset isn’t installed.

What is the proper way to have this done automatically? I know about the mechanism with packages and assembly definitions. But is it also possible to have e. g. a scripting define symbol created if a dedicated file or a folder like “Assets/NatureManufacture Assets/River Auto Material” exists? Or is there another way with which I don’t have to bother the users to create scripting define symbols manually?

You can write an editor script that checks to see if a define exists, then jams it in if it doesn’t.

I’ve seen this done by packages such as DREAMTECK_SPLINES and ODIN_INSPECTOR

If you do write such a thing it kinda begs the question of why even have the predefine in the first place. If I want your code to be gone and turn off the define, then the script puts it back. Sounds like over-engineering to me. Just leave the code in all the time and the stripper will remove it if it’s not used. I suppose if you have some predefine that R.A.M provides, you could look for that and then turn your stuff on in an editor script.

1 Like