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
2
Question by damianf · Apr 12, 2012 at 06:06 AM · editorproceduralmapcustom-inspector

Custom Inspector with Procedural Mesh Preview?

EDIT: My question, in short, is: Is it appropriate to create procedural Meshes (and GameObjects) in a custom inspector for visualizing data in the scene view while the game isn't running? And if that's a workable approach, how do you manage the lifespan of these generated objects so they don't linger and clutter up the game scene when you're not editing the object?

More details:

I have a class -- call it Map -- that creates its mesh representation at runtime. Map is just a data class; serializable but it's not a MonoBehaviour. When it needs to be represented, I create a MapRepresentation, which is a MonoBehaviour. This class then instantiates a bunch of Meshes based on the map.

So far so good! But I want some kinds of Map to be editable by hand in the editor. Let's call these ManualMaps. To make this great, I wanted to actually have a custom ManualMap inspector that, among other things, shows the representation of the map in the scene, and allows you to click on it and manipulate it in the editor scene. I have some casual handle (pun intended) on how to do this.

My problem is that I am not sure how to correctly create the procedural meshes. If I instantiate a MapRepresentation in OnEnable & make it a child of the ManualMap, well, it never goes away. It's not at all temporary. Do I need to intercept de-selection of the ManualMap & Destroy the MapRepresentation? I mean, this is all starting to feel very clunky and against the grain.

Unity pros, how would you solve this problem?

Comment
Add comment · Show 1
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 piXelicidio_ · Jun 28, 2019 at 02:22 AM 0
Share

Is sad to see this question unanswered for so many years... When I'm researching to do something that needs similar functionality.

0 Replies

· Add your reply
  • Sort: 

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

Null reference exceptions when using a Custom Editor 0 Answers

Custom Editor Search bar 2 Answers

Custom Inspector: Accessing a reference to another MonoBehaviour? 1 Answer

What is a GUILayoutOption[] 3 Answers

Post-Process All Unity Scene GameObjects 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