• 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 SFvdB · Mar 10, 2014 at 09:15 PM · prefabserializationassetsgenerating

Best approach to one-time generation: Assets, Serialization or manual labor?

What I want to achieve is this: A one-time generation of an X by Y field of gameobjects (tiles in a grid, basically). Afterwards I would like to be able to adjust the X or Y by using an editor window or inspector panel.

Making a script to generate a grid of items is easy. Now I want the tiles to stay in place after assembly reload. Or even when I reopen the project.

However I am lost to what is the best approach to this. Is it by using prefabs/resources and creating individual assets? Running the script only once?

Or perhaps through a serialized list of gameobjects which will use OnEnable to check if the required X and Y tiles are there?

I can manually place each item on each gridpoint (and adjust each item's name) but understandibly that should be a chore left unnecessary.

Which is the best avenue to go down? Thank you.

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
0

Answer by Owen-Reynolds · Mar 10, 2014 at 11:11 PM

I'm thinking a Unity "editor script" can make permanent changes to objects. In theory your current grid placement code would be translated into one of these. Might end up with a custom Inspector for a "gridScript" object, with a slider for size, etc... . Any cool packages with funny-looking Inspector panels were made that way.

They are a pain to figure out, lots of magic words, but I think the sort of thing that once you know how, you want to make one for everything.

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 SFvdB · Mar 11, 2014 at 07:33 AM 0
Share

Thanks. It would seem so, wouldn't it? What I have been struggling with, though, is using prefabs in unapplied scripts. But perhaps the /resource folder might help with that.

Right now I think the best avenue is that of trying to instantiate real objects: IE, assets. Therefor I am investigating this package by $$anonymous$$ike "@runonthespot" http://forum.unity3d.com/threads/175168-Scriptable-Object-simplest-use

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

21 People are following this question.

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

Related Questions

When compressing assets for .APK does whole projects assets get included? or just the scenes assets? prefabs? 1 Answer

I need to hack my PC built game .assets files - but how? 1 Answer

Variable modified with custom editor not saved when enter play mode, even with serialized attributes. 0 Answers

Loosing sprite association when transferring prefab 1 Answer

Private list is serialized inside a prefab 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