Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Gobla · May 13, 2012 at 05:34 PM · buildlayerdetailprototype

Scripted detaillayer prototypes won't show in build.

Hello there,

I've found an issue with the terrain detaillayers. Script-added detaillayer prototypes won't show in the windows build.

As a test i've created the detaillayers in following way:

1) Added detaillayer prototypes trough the terrain tools (both textures and vertex-lit).

2) Added detaillayer prototypes to the same terrain with the following script (snippet):

     DetailPrototype[] oldDetailPrototype = terrain.terrainData.detailPrototypes;
     DetailPrototype[] newDetailPrototype = new DetailPrototype[(terrain.terrainData.detailPrototypes.Count() + gameObjectList.Count())];
     int[] referencelist = new int[gameObjectList.Count()];
     
     for (int i=0;i<terrain.terrainData.detailPrototypes.Count();i++) {
         newDetailPrototype[i] = oldDetailPrototype[i];
     }
     
     int counter = 0;
     int j = terrain.terrainData.detailPrototypes.Count();
     foreach(GameObject obbie in gameObjectList) {
         DetailPrototype prototype = new DetailPrototype();
         prototype.prototype = obbie;
         prototype.dryColor = Color.black;
         prototype.healthyColor = Color.black;
         prototype.noiseSpread = 0.1f;
         prototype.renderMode = DetailRenderMode.VertexLit;
         prototype.usePrototypeMesh = true;
         prototype.minWidth = 0.75f; 
         prototype.maxWidth = 1.0f;
         prototype.minHeight = 0.75f;
         prototype.maxHeight = 1.0f;
         newDetailPrototype[j] = prototype; 
         referencelist[counter] = j;
         j++;
         counter++;
     }
     
     terrain.terrainData.detailPrototypes = newDetailPrototype;
     terrain.terrainData.RefreshPrototypes();
     terrain.Flush();

3) Both the tool-added and the script-added detail prototypes are then assigned trough a script to the detaillayers.

4) In the Unity editor both the tool-added and the script-added details appear on the terrain on runtime.

5) In a build only the tool-added details appear on the terrain on runtime

The runtime error log shows no errors or notices regarding this what so ever. Adding the prefabs in the resource folder makes no difference.

Do you have any idea why this issue appears? And do you have a possible solution for this?

Thanks in advance!

Comment
Add comment · Show 3
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 Gobla · May 13, 2012 at 07:53 PM 0
Share

Now i've tested this on the following platforms:

  • Windows (32 and 64bit)

  • $$anonymous$$acOS

  • Webplayer

And none of them shows the detail layer prototypes added by the script while the IDE player does.

avatar image Gobla · May 18, 2012 at 07:07 PM 0
Share

A notice: Still persistant in 3.5.2

avatar image ODINKONG · Aug 23, 2016 at 09:01 PM 0
Share

I'm having the same problem and were now on unity 5.3.1. What is going on?? I need to create grass at run time and it works fine in editor but comes out black or invisible in build.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by GXMark · Apr 09, 2014 at 04:45 PM

I've tested the SplatPrototype, DetailPrototype in scripting at runtime (Editor and Seperate PC/MAC Build) and it all updates fine. This includes adding prototype then re-applying the prototypes for splats and modifying the detail prototype settings at runtime. I have heard there are issues with running this via a web player but have not investigated this build type yet.

Comment
Add comment · 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

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Terrain building with errors 0 Answers

Culling Terrain detail objects by layer 0 Answers

DetailPrototype 1 Answer

build and run/ saved scene is not updated when application is loaded. 0 Answers


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