Skip to content

Instantly share code, notes, and snippets.

Avatar

James Frowen James-Frowen

View GitHub Profile
View SimpleBenchmark.cs
/*
MIT License
Copyright (c) 2022 James Frowen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
View .editorconfig
# Remove the line below if you want to inherit .editorconfig settings from higher directories
###############################
# Core EditorConfig Options #
###############################
root = true
[*.{cs,csx,vb,vbx,md}]
indent_style = space
indent_size = 4
tab_width = 4
View Unity 2021 LTS Server build changes.md

Unity has changes how to create server build in 2021

Building from script

replace:

if (serverBuild)
    buildOptions |= BuildOptions.EnableHeadlessMode;
View CompileBenchmarking.cs
/*
MIT License
Copyright (c) 2022 James Frowen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@James-Frowen
James-Frowen / MessageTracker.cs
Created Feb 11, 2022
Message tracker for mirror
View MessageTracker.cs
/*
MIT License
Copyright (c) 2021 James Frowen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@James-Frowen
James-Frowen / NetworkObjectCreater.cs
Last active Apr 12, 2022
Helper to create network objects at runtime
View NetworkObjectCreater.cs
/*
MIT License
Copyright (c) 2021 James Frowen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@James-Frowen
James-Frowen / EchoSocket.cs
Created Oct 17, 2021
Behaviour that makes Sockets echo back message. For Mirage networking
View EchoSocket.cs
using System.Text;
using UnityEngine;
namespace Mirage.SocketLayer
{
/// <summary>
/// Monobehaviour to help debug a cloud server, can help check if ports are open and a socket is sending message correctly
/// <para>Server will echo back the message that was sent to it</para>
/// <para>Client will send 4 byte message every second, incrementing by 1 each time</para>
/// </summary>
View NetworkSceneCheckerSimple.cs
using System.Collections.Generic;
using UnityEngine;
namespace Mirror
{
/// <summary>
/// Component that controls visibility of networked objects between scenes.
/// <para>Any object with this component on it will only be visible to other objects in the same scene</para>
/// <para>This would be used when the server has multiple additive subscenes loaded to isolate players to their respective subscenes</para>
/// <para>Does not actively check if scene has changed</para>
@James-Frowen
James-Frowen / NetworkManagerGUI.cs
Created Mar 16, 2021
OnGui for NetworkManager to make iit quick to set up and start a server
View NetworkManagerGUI.cs
using Cysharp.Threading.Tasks;
using UnityEngine;
namespace Mirage
{
/// <summary>
/// An extension for the NetworkManager that displays a default HUD for controlling the network state of the game.
/// <para>This component also shows useful internal state for the networking system in the inspector window of the editor. It allows users to view connections, networked objects, message handlers, and packet statistics. This information can be helpful when debugging networked games.</para>
/// </summary>
[DisallowMultipleComponent]
@James-Frowen
James-Frowen / ExitPlayModeOnCompile.cs
Created Feb 15, 2021
Exits play more when scripts are recompiled
View ExitPlayModeOnCompile.cs
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
namespace JamesFrowen.EditorScripts.Compilation
{
/// <summary>
/// Stop the game the scripts are recomplied
/// </summary>
[InitializeOnLoad]