- Home /
How do I make a level editor in the editor
In my project once it starts up. I am creating a grid. each node has specific data. What I need to do is to create the grid in edit mode so I can change some of the nodes data.
I am aware I can addComponentMenu but not sure how to make it all work.
When we create this grid in edit mode I also need to save the changes so when I do run the game the node data is the same as the node data in the edit mode.
Any help would be appreciated thanks.
Answer by qJake · May 19, 2010 at 04:05 AM
You can write your own Editor script to automate some of the things you may need to do repetitively while editing your game.
See the Editor Scripting Reference for a list of objects you can use in your editor scripts. You can also see this handy-dandy guide on How to extend the Unity Editor.
More editor example scripts can be found here at the Unify Community Wiki.
I have looked at all that info and it's helping me out a bit. I have a custom inspecotr that has a slider for row and columns. Also a button to create the grid based on the row and colums. It works and creates my nodes in the editor. The problem I have is that once I run the game any changes I make to the nodes aren't saved and neither is the grid i made
If you make changes to your game while it's in Play $$anonymous$$ode (the Play button is ON at the top), then your changes won't be saved. You can only make permanent changes when you aren't in "play mode".
Hi! I have a similar problem to yours! I'm trying to set class variables through getters & setters. I wrote a custom editor that exposes these methods. The code works just fine, that is if I change values while the game is in play mode, these values are passed to the respective variables. However if I set the values in edit mode, the values are lost as soon as I click on the Play button (values are actually set to the default). I've added the @script ExecuteInEdit$$anonymous$$ode() but to no avail! How can persist the changes I've made in the custom editor while in edit mode?
in C# add this to the top of your code [ExecuteInEdit$$anonymous$$ode] and JS
@script ExecuteInEdit$$anonymous$$ode()
Your answer
Follow this Question
Related Questions
How do I create a new object in the Editor as a child of another object? 1 Answer
Override scene view grid with my own? 0 Answers
Editor Scripting Question 1 Answer
Editor menus are invisible 1 Answer
Updating Player Settings with code 2 Answers