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 ScriptingTaco · Mar 01, 2015 at 09:58 AM · editorprefabtilemapcreate

Instantiate prefabs before runtime, inside editor

Hello! How do I instantiate prefabs so I can interract with them in the editor, without the game running? Instantiating prefabs is not the problem, but to do it once to create a map for the editor is what I need some help with.

I have searched for this online without any good results, so hopefully someone here knows a good way to do this :)

Thanks in advance.

EDIT


I know that I can simply drag a prefab to my editor. Say I want a 10x10x10 cube made up from smaller same-sized cubes. Instead of dragging in 1000 prefabs att an exact location, I want to add them from script, something like this:

 for(int i1=0;i1<10;i++){
    for(int i2=0;i2<10;i2++){
       for(int i3=0;i3<10;i3++){
           InstantiateIntoEditorBeforeRuntime(Resources.Load("myPrefab"), Vector3(i1,i2,i3));
       }
    }
 }

(something like that)

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 meat5000 ♦ · Feb 28, 2015 at 10:22 PM 0
Share

Dragging them in to the scene won't do?

avatar image Wampster · Mar 01, 2015 at 10:04 AM 0
Share

If I understand what you're trying to do, just drag the the prefab in to the scene.

avatar image ScriptingTaco · Mar 01, 2015 at 11:27 AM 0
Share

Sry for not explaining enough, I have edited my question :)

1 Reply

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

Answer by m4c0 · Mar 12, 2015 at 06:39 PM

Use PrefabUtility.InstantiatePrefab to do the instantiation. The manual page have an example similar to what you need (add three inlined loops and you are done).

IMHO, a 10x10x10 cube of objects will be strange to manage in editor. I wonder if that's really necessary... :)

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 ScriptingTaco · Mar 12, 2015 at 06:59 PM 1
Share

Yea the 10^3 cubes was just a way of saying it :3

Thanks alot for your help! :D I have been searching for this for some time. :)

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

Is there a HideFlags.DontSave equivalent for preventing child objects from being applied to a prefab? 0 Answers

prefab brush paint in another tile 0 Answers

Created Prefabs and added them into a List in Editor Mode, after PlayMode, these GameObject are not in the List anymore 0 Answers

Prefab generalization 1 Answer

drawing path on the polygon surface and insert objects along that path 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