- Home /
Duplicate Question
Add Script to Project at Runtime
I want to attach a .cs file to a gameobject at Runtime. So far all good.
Now the thing is this file is located at let's say "D:\My Documents\MyScript.cs".
Is there a way to import that into the project at Runtime?
Do you really mean you want to import a script file into your project? (why?) You can do that using System.IO, but simply copying it to the project directory will have no particular effect. Or do you want to add a script to a gameobject in the scene? You can do that with AddComponent. Or do you want to import a script file, compile it, and then make use of the functions it contains? You can't do that.
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Cannot import Unity Serializer(save&load) 2 Answers
Custom Export and Import FBX Data 1 Answer