- Home /
Add lines to a script from another script
Hi guys! I want to know if there is any way I can edit a script from another script.
Let me explain: I'm working on a serialization system based on this video from GameDev Guide: https://youtu.be/5roZtuqZyuw
The problem is that I need to create a Serialization Surrogate for every non-serializable script (for example, an ScriptableObject for an inventory item) and then add 2 more lines on the SerializationManager.GetBinaryFormatter() (one for creating the variable and other to add it to the selector). What I want to do is to make an Editor script that picks a script and then verify: "if its a SerializationSurrogate script, then add it to SerializationManager.GetBinaryFormatter(), both in variable and in the selector", for automating the process (because every time I need to make an ScriptableObject serializable, I need to do this, based on my testings).
Is there any way to do this?