Getting into the s&box workflow

Started by Zaubermuffin 1 post 118 views

Reply on sbox.game
  1. #1
    Zaubermuffin 60
    Hello,

    I've been dabbling with Unity for a few years now, and I've gotten used to its good and bad sides. I was trying out s&box and was really impressed by some of the systems, but I'm constantly getting stuck with what I feel should be trivial things. I realize that this isn't necessarily an s&box issue, but more of an engine/workflow issue, as I'm used to how Unity does it, and have no real clue on how s&box/Source is supposed to do it.

    Are there any good resources for developers that are familiar with Unity to transition into s&box? As in, "X in Unity can be done like Y in s&box"?

    One particular example would be a simple traffic light including a script. In Unity, I've created a mesh which includes the light bulbs, import this into Unity, assign materials to each mesh renderer in the importer settings, make a script that gets three renderers assigned (one for each light), then use these references to change the color + emission of the renderer to make it appear "on" (or "off") base on some logic or external input/API.

    In s&box, this seems to... not work this way?
    • fbx are imported as "one" model? While I can re-assign materials to each fbx-material, I cannot reference the individual lamps post-import. What is the supposed workflow here? Have one basic mesh for the fixture, one for a lamp, and then use a prefab (?) to merge them together? Does this mean that the "final assembly" of any more complicated object has to necessarily be done in s&box? I'm not super opposed to final assembly being done in the editor rather than the modelling program, as it allows you to tweak things around, but it in some cases (e.g. this one), it feels burdensome - especially if you can't use empty objects to get the position/rotation of where another object should go.
    • Can the standard materials even be modified at runtime (without having to write a custom shader that supports this)? In Unity-terms, I'm thinking of modifying `renderer.material` and/or `MaterialPropertyBlock`s
    • Because I struggled with this bit so far, I haven't dug deeper into the script/prefab sides yet. From a quick try though, it seems as if the prefabs are basically "opaque" too, i.e. they are treated as one object? So if I had a prefab with the fixture + three lights + a script on it, it would not be possible to reference e.g. one of the light objects if it was dragged into the scene(/spawned in) as a prefab?
    Sorry for the rather stupid questions. I did do some stuff with GMod/SourcePawn in the past, so Source isn't completely unfamiliar to me, but I never really touched the asset workflow at all and kept myself to the scripting side.