How to convert string to runnable code?
So i got an idea for personalisation game/app and i don't want to hard code what will characters or objects do.I would make them stationary or inanimate and let the user place code blocks and make the character/object do whatever he wants.I'm thinking about scratch kind of blocks if you ever used it you know.So when the user places blocks i convert them to string and then to runnable code. Example: [Jump] [Wait 3s] [Teleport Left 2 Units] And then it converts it to code string: "Rigidbody.Velocity = new Vector3(rigidbody.velocity.x, rigidbody.velocity.y + 5f, rigidbody.velocity.z); Wait(3f); transform.position = (transform.position.x - 2f, 0f, 0f);"
And then i would convert it to runnable code and run it.Or loop it if user wants?So can it be done?