Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to allow players to create plugins

Discussion in 'Scripting' started by DanVioletSagmiller, Oct 10, 2022.

  1. DanVioletSagmiller

    DanVioletSagmiller

    Joined:
    Aug 26, 2010
    Posts:
    203
    I'm considering different ways to allow players generate plugins for an RTS I'm working on. It is focused on PC and Mac. What are some ways I could allows players to make their own custom addon's for the game?

    I'm considering creating a separate unity package with hooks and API's, that is also included in the main build, and letting the players develop their own addons with unity and C#. I've also heard of other games using LUA and similar scripting systems in the games.

    Have you built these? What advice could you give? What practical issues are there? any good articles? - Thanks!
     
  2. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    AnimalMan likes this.
  3. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    A game called Project Zomboid one of my fav go to games allows its users to write custom script, in c format. Voids and stuff I couldn’t recite the terminology to you. But it is one of the primary reason for which the game is beloved by its huge and active player base. I assume they allow the modder to write scripts but they are still limited to specific parameters though the range included is quite vast. I do not mod the game myself to explore these features but apparently it is quite extensive and from what I have seen it is practically the same format as C
     
  4. DanVioletSagmiller

    DanVioletSagmiller

    Joined:
    Aug 26, 2010
    Posts:
    203
    Thank you. I'll look into Harmony and Zomboid first, but I'm thinking of going the Roslyn/C# compiler route at present. I wrote a system on that a while back. The key trick to it was using Roslyn to pre-analyze the code and only allow certain name spaces/classes/functions, in order to generally protect people from other malicious code. But that also means creating the debugger for it. However, it also means that well developed pieces can be imported into the compiled project without much effort.