Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Will 10 · Aug 08, 2010 at 10:42 AM · terraintilebatching

Unity Batch Terrain Creation Script?

Hi all,

I'm new to Unity, but not to programming. I'm just browsing over the API, and can't find the necessary calls to do what I want.

Basically, I want to create a new TerrainData object, set heights, and then set texture, and lightmap (all of which I'm ok on). Here's the thing, I want to do this without creating a terrain object, and want to save the TerrainData object to the Project folder.

Basically, I'm gonna plough through a batch of terrain tiles, and create a TerrainData object for each, then save all these somewhere in the Project folder (preferably the Resources folder).

Any ideas anyone?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by qJake · Aug 08, 2010 at 11:12 AM

Just write an editor script that does this:

Create a game object.

Add a Terrain component to it.

Set stuff with the terrainData property.

"Save" the asset by actually creating a new asset using AssetDatabase.CreateAsset. I don't know what file extension you need to use (it matters!), so just create a Terrain using the editor, and then browse to where it is in your Assets folder on your computer, and see what file extension it is (it might be ".asset" or ".terrain" if I had to guess).

More on extending and scripting for the Unity Editor

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Will 10 · Aug 09, 2010 at 06:17 PM 0
Share

Hi, I may be missing something here, but I need to get the TerrainData assets into the Resources folder of that particular build. AssetDatabase.CreateAsset doesn't seem to do this, even with path "Assets/Resources/data.asset"..

avatar image qJake · Aug 09, 2010 at 07:33 PM 0
Share

TerrainData isn't an asset, it's a data structure that's tied to a Terrain object that provides the heightmap and related information. You can't have a "TerrainData" asset.

avatar image Waz · Aug 15, 2010 at 08:39 AM 0
Share

Yes you can. Indeed, you can make two Terrain objects with the same TerraidData (not sure why you would, but you can).

avatar image qJake · Aug 15, 2010 at 09:29 AM 0
Share

Uh... I'm pretty sure Unity won't let you create a TerrainData asset via the Editor (I'm talking about a physical asset here, that shows up in the Asset list), but if you used CreateAsset(), it might be possible, I haven't checked. I think it's doubtful, though.

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Changing terrain in real time 1 Answer

Any resources for using grid/tile data structures with terrains? 1 Answer

Make a simple tree 1 Answer

How can I create a grid/tile based shader supporting multiple textures? 1 Answer

How do I remove terrain texure blending? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges