V
V
vodimak2022-03-08 21:00:42
Unity
vodimak, 2022-03-08 21:00:42

How to make a level editor in the game?

I'm making a pixel game and I want to make an editor in it, but how. it is necessary: ​​to allow the player to draw the background, to give the opportunity to set obstacles, copy them, upload their music, upload the level to the network, I will deal with the rest by analogy. Throw off some video or article or write it yourself or something else, otherwise I didn’t find anything myself.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail, 2022-03-11
@vodimak

Look at the work with the system and
Tipo 's assets

AssetDatabase.CreateAsset(asset, path);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();

To save files as assets
var stream = new FileStream(path), FileMode.OpenOrCreate, FileAccess.Write);
var writer = new BinaryWriter(stream);
writer.Write(anyChar); 
writer.Close();
stream.Close();

To write text information to a file
Before the audio, the user will need to ask the user for a path, then save the paths as text and load them when the level starts. Search for something like Load user sounds at runtime in unity.
For about the same request, you can find how to upload files to the network through unity.
In principle, you can find everything you want if you write requests in English. If there are problems with English, then Google translator translates accurately enough to understand the essence or formulate a question.
It is better to put obstacles on a certain grid. The grid can be made by rounding the values ​​of the position of the object to some multiple values. Object creation - Instantiate - you just drag the current object through it and create a copy. It is better to limit the number of objects of each type. You will need to create counters for all objects.

N
Nekit Medvedev, 2022-03-09
@NIKROTOS

Show what the level will be (example), determine what will be in it, what objects, background, objects with which you can interact, static objects. Depending on all of the above, you need to think about how you encode information, for example, a map like in a teraria, you can encode it into a text file (the position of the character is equal to the position of the object, its symbol means the type of object) or texture (by pixel position and color) .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question