A
A
Andrey2020-09-22 17:14:47
C++ / C#
Andrey, 2020-09-22 17:14:47

How to edit the code of the game, being directly in this game?

Hello. Yes, the question is asked stupidly, I understand!
It is necessary to implement a text field in the game in which the user will write code, click on the "Run" button, and the code will be executed in the game.
How to implement it? Where to dig?
Thank you.

For example:
There is a sphere on the screen.
The user enters:

GameObject.Find("UserButtonInput(Clone)");
transform.position = Vector2.MoveTowards(transform.position, Target.position, step);

Clicks on the "Execute" button.
The sphere is moving.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mopsicus, 2020-09-22
@mopsicus

Well, for example, use something like this, although I'm not sure that the above example will work
https://github.com/Leopotam/LeopotamGroupLibraryUn...

D
dollar, 2020-09-22
@dollar

If this is not for your convenience, but for the convenience of users, then Lua is better, namely MoonSharp. The language is simple, easy to learn, and the user does not need a deep understanding of C#.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question