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
0
Question by vanhouten777 · Feb 11, 2012 at 12:27 PM · prefabsstatic

How do we access static prefabs?

Hi Friends,

How do we access static prefabs of the same kind in the scene through scripting?

Regards, vanhouten777.

Comment
Add comment · Show 5
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 Posly · Feb 11, 2012 at 02:02 PM 1
Share

Try to give more info and details and explain what you are doing.

avatar image vanhouten777 · Feb 12, 2012 at 03:39 AM 0
Share

Sir,

I am trying access static prefab trees and want to find the closest tree.

Regards, vanhouten777.

avatar image Bunny83 · Feb 12, 2012 at 03:51 AM 0
Share

@vanhouten777: Ok, first off don't post such things as an answer!! Use comments or edit your question. I've converted your answer into a comment.

Second what the heck are "static prefab trees"? You have been asked to clarify your one line question, but this doesn't help in any way.

Prefabs are predefined GameObjects that resist in the project and they can be instantiated into the scene. Instantiated prefabs are usual objects like every other object in the scene. Only in the editor you still have the information of the prefab from which the object was instantiated. At runtime this isn't available.

Prefabs also can't be arranged in trees. A prefab can contain whole GameObject trees, but a prefab can't contain other prefabs.

So before anyone can answer your question you should explain detailed what you mean by "static prefab trees" and how you want to "access" them.

avatar image vanhouten777 · Feb 12, 2012 at 01:20 PM 0
Share

Sir,

I created a tree gameobject and created a empty prefab and dragged the tree game object to the empty prefab and used the tree prefab to place trees in the scene. Static prefab means the prefab was created during scene creation and not run time. Can we access tree prefab like arrays Tree[77] etc etc.

regards, vanhouten777.

avatar image vanhouten777 · Feb 12, 2012 at 04:10 PM 0
Share

Do we have to use instance manager?

regards, vanhouten777

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Bunny83 · Feb 12, 2012 at 01:42 PM

Ok, i think i get what you want (at least it's a bit more clear now). So you talk about Unity's terrain engine and the tree-detail prefabs.

The TerrainData of your terrain script contains everything about the terrain. I guess you want either:

  • TerrainData.treePrototypes which returns the list of prototypes / prefabs you can place on the terrain.

  • TerrainData.treeInstances which returns the list of all tree instances you've placed on the terrain (of course at edit-time).

Comment
Add comment · Show 1 · 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 vanhouten777 · Feb 13, 2012 at 04:44 AM 0
Share

Thanks.

vanhouten777.

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

6 People are following this question.

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

Related Questions

Static model with armature? 0 Answers

How do i imports my variable to another variable and save it with PlayerPrefs? 0 Answers

Hi, i have foreach on 30 GO's that twice a second,finds tags(cca100),so i was thinking of making a static List of those 100, find them at start , and then subtract accordingly,should i be aware of something? 1 Answer

Storing Scriptable Item Objects in a static array?,Static Array In a Static class for referencing an item database. 0 Answers

How do I make collisions where both objects are moving but pass through each other? 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