Sandbox Entities

Started by garry 30 posts 2,241 views

Reply on sbox.game
  1. edited Nov 2025 #1
    garry Facepunch 2,355
    A thread to discuss the creation, spawning and limitations of Sandbox Entities.

    How to make a Sandbox Entity

    Now you'll be in the editor with Sandbox and your addon loaded
    • If the Sandbox scene isn't open, go to asset browser, click on Sandbox on the left, then search for sandbox.scene and open it
    • Pressing play should let you play Sandbox like normal
    • In Asset Browser, in your addon's Asset folder, right click and go to new > Sandbox > Sandbox Entity
    • Name it whatever you want
      image.png 7.88 KB
    • Do it again, but create a new prefab.
    • Select your Sandbox Entity and drag the prefab into the Prefab field and press SAVE
    • Your SENT will now be spawnable in the game when you press play, under the Local tab
    image.png 30.5 KB

    You can do whatever you want in your prefab now. If you want people to drag it around make sure it's got a Rigidbody.

    When you publish, if you added custom code, like custom components - then tick the Include Code checkbox.



  2. #2
    Papa Brickolini 6,401
  3. edited Sep 2025 #3
    ShadowBrain 6,513
    sbox-dev_z98LD8aIJ6.mp4 8.41 MB
    Voice recognition => Safety/moderation check => Shake to submit to an LLM for answering.
    Fun stuff!
    edited:
    (It would work a lot better if the voice recognition was better, it's VERY hit/miss right now)
  4. edited Sep 2025 #4
    badandbest 575
    What are the reasons you went for a custom gameresource over just using prefabs? 

    Edit: I remember old add-ons just used a "spawnable" tag to differentiate them.
  5. #5
    garry Facepunch Started this 2,355
    So they would be distinguishable from prefabs
  6. #6
    100°c 910
    People are getting this error when trying to use my sents

    2025/09/02 21:59:51.9347    [Generic] Failed to fetch package info for gmodn.usables_hotdog: package not found.   
    2025/09/02 21:59:51.9347    [Generic] Cloud: Package gmodn.usables_hotdog has no PrimaryAsset   


    What would be causing this? I'm pretty certain I have my definitions set up properly.
    image.png 17.73 KB
  7. #7
    garry Facepunch Started this 2,355
    Hmm, I wonder if that's when the Sent is created on staging but they're playing on the main branch?
  8. edited Sep 2025 #8
    Beno 760
    ild say so, had some enitiys not working on main and once i swapped to staging. they worked 
  9. edited Sep 2025 #9
    Braxen 🐟 190
    Object reference not set to an instance of an object.
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Editor.AssetList.DrawAssetEntry(VirtualWidget item, AssetEntry asset) in C:\program files (x86)\steam\steamapps\common\sbox\addons\tools\code\Editor\AssetList\AssetList.cs:line 361
       at Editor.AssetList.PaintListItem(VirtualWidget item) in C:\program files (x86)\steam\steamapps\common\sbox\addons\tools\code\Editor\AssetList\AssetList.cs:line 298
       at Editor.BaseItemWidget.PaintItem(VirtualWidget item)
       at Editor.BaseItemWidget.OnPaint()
       at Editor.ListView.OnPaint()
       at Editor.Widget.InternalPaintEvent(QPainter e, Int32 flags)
       at Managed.SourceTools.Exports.Editor_BaseScrollWidget_InternalPaintEvent(UInt32 self, IntPtr e, Int32 flags)
    Getting this when I try to search for the sandbox scene. On both staging and release. Can only find minimal scene in the everything browser.

    Nothing happens when I try to select a prefab for the entity either, field doesn't populate.
  10. #10
    garry Facepunch Started this 2,355
    I'll look into that
  11. #11
    Braxen 🐟 190
    I got it working after a few restarts but having real trouble with IDE analyzing, not recognising TypeLibrary/Log etc.

    Nothing seems to happen when you call OnDamage on the IDamageable interface on the player either
  12. #12
    Zontax 8,912
    Braxen make sure that in your .csproj file you have
    <ItemGroup>
        <Using Include="Sandbox.Internal.GlobalGameNamespace" Static="true" />
        <Using Include="Microsoft.AspNetCore.Components" />
        <Using Include="Microsoft.AspNetCore.Components.Rendering" />
    </ItemGroup>
    and maybe
    <ItemGroup>
        <ProjectReference Include="D:\Games\Steam\steamapps\common\sbox\addons\base\Code\Base Library.csproj" />
    </ItemGroup>
    Because for some reason they disappeared from my addon project and I returned them.
  13. #13
    100°c 910
    Demo of a Mac 128k virtual machine running in the Sandbox gamemode, powered by Infinite Mac

    I had to clone the contents of the Sandbox game so I could mess with the WebPanels properly but it's coming along quite nicely. Model is from Spicy Apple but is most likely to be placeholder since I don't know if I'm going to be able to get an original model made, I may just ask Spicy if I can use this one if I can't though.

    Not sure how I would transfer over keyboard inputs, as WorldInput doesn't have support for that, but other than that it is looking nice.
    mac128kdemo1.mp4 7.48 MB
  14. #14
    Zontax 8,912
    Is it necessary to create a subfolder with its own unique name in the addon project in the Assets folder and place other folders and resources in it (like Assets/zontax_addons/...)? Is this not necessary? Can there be path collisions that will turn into a problem, for example, if the resource in the addon has the same path as the resource path in the sandbox game itself or the same as in another addon?
  15. #15
    garry Facepunch Started this 2,355
    It's not necessary, but it would be ideal if you tried to make your filenames as collision free as possible.
  16. edited Sep 2025 #16
    Zontax 8,912
    Although why should I worry sents? They are the same resources as others, and there are no problems with them
  17. #17
    garry Facepunch Started this 2,355
    Alright I fixed some bugs on staging. Opening the addon should be a lot more stable now, should no longer get missing models and textures and effects, and the context menus should work properly.
  18. #18
    100°c 910
     Functional Minecraft Sign :3
    sbox.2025.09.07.09.18.47.mp4 61.14 MB
  19. #19
    QuackCocaine 165
    Would be neat if the old toybox download progress ui animation could be remade to show download progress of sents. 
  20. #20
    Divined 105
    Anyone that used UI with their entities yet that us noobs can take a peep at?
  21. #21
    Kronax 1,237
    I clicked on the asset browser, but I couldn't see sandbox.scene here. I also selected the target game `sandbox` and restarted the project.

    image.png 146.63 KB
  22. #22
    garry Facepunch Started this 2,355
    Are you on staging?
  23. #23
    Kronax 1,237
    nope
  24. #24
    garry Facepunch Started this 2,355
    Get on staging and give it a go m8
  25. #25
    Sophia 4,378
    anyone else unable to find the sandbox.scene file, type
    install facepunch.sandbox
    in console

  26. #26
    garry Facepunch Started this 2,355
    Updated OP with new instructions
  27. edited Nov 2025 #27
    Zontax 8,912
    Braxen make sure that in your .csproj file you have
    <ItemGroup>
        <Using Include="Sandbox.Internal.GlobalGameNamespace" Static="true" />
        <Using Include="Microsoft.AspNetCore.Components" />
        <Using Include="Microsoft.AspNetCore.Components.Rendering" />
    </ItemGroup>
    and maybe
    <ItemGroup>
        <ProjectReference Include="D:\Games\Steam\steamapps\common\sbox\addons\base\Code\Base Library.csproj" />
    </ItemGroup>
    Because for some reason they disappeared from my addon project and I returned them.
  28. #28
    Sophia 4,378
    Made a car with the new seat, pretty easy to do actually
    sbox-dev_M3rKK8R4VB.mp4 31.8 MB
  29. #29
    strangerdanger 2,255
    entities custom code components don't seem to spawn or work correctly when it has the inventory pickup component
  30. #30
    Zontax 8,912
    Make Entities great again!