Skip to content

Instantly share code, notes, and snippets.

View James-Frowen's full-sized avatar

James Frowen James-Frowen

View GitHub Profile
@James-Frowen
James-Frowen / TransformValues.cs
Created October 9, 2020 17:33
TransformValues, syncs values of a transform even if it does not have a NetworkIdentity
namespace Mirror
{
public struct TransformValues
{
[Flags]
public enum SyncMode : byte
{
none = 0,
position = 1,
rotation = 2,
@James-Frowen
James-Frowen / ChildNetworkBehaviours.cs
Last active August 31, 2020 11:17
Allows syncing of NetworkBehaviours in child objects.
using System;
using System.Linq;
using Mirror;
using UnityEngine;
namespace JamesFrowen.MirrorExamples
{
/// <summary>
/// Sync NetworkBehviours in chuld objects
/// </summary>
using System.Collections.Generic;
using Mirror;
using UnityEngine;
namespace JamesFrowen.MirrorExamples
{
public class PrefabPoolManager : MonoBehaviour
{
[Header("Settings")]
public int startSize = 5;
@James-Frowen
James-Frowen / MirrorPrefabPool.cs
Last active May 9, 2024 08:38
Prefab Pool for Unity and Mirror Networking, see simple example here https://gist.github.com/James-Frowen/46ca5e8fd76d62527be7b958ca8dbaf1
using Mirror;
using UnityEngine;
namespace JamesFrowen.Spawning
{
public class MirrorPrefabPool : PrefabPool
{
private readonly NetworkIdentity _networkPrefab;
private bool _handlersRegistered;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace JamesFrowen.EditorScripts
{
public static class SpriteMaker
{
[MenuItem("Tools/Sprite Maker/Make Circle 256x256")]
public static void MakeCircle()
public abstract class AssetSet : ScriptableObject { }
public abstract class AssetSet<T> : AssetSet where T : Object
{
[SerializeField] protected List<T> _items = new List<T>();
private Dictionary<string, T> _dictionary;
public string TypeName => typeof(T).Name;
public const string CAN_NOT_FIND_WARNING = "{0} could not find {1}";
@James-Frowen
James-Frowen / TelepathyTransportWithLag.cs
Last active June 26, 2020 23:22
TelepathyTransport for mirror but with an array of queues to store message for `framesOfLag` frames before being processed by mirror. `chanceToSkip` can be used to add random delay to some frames skipping an extra frames before they are read/processed
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.Net.Sockets;
using Telepathy;
using UnityEngine;
using UnityEngine.Serialization;
namespace Mirror
@James-Frowen
James-Frowen / NetworkProjectile.cs
Last active October 1, 2020 22:16
Working, but unfinished Projectile Manager for the Wolves games, built with Mirror
using Mirror;
using ProjectWolves.Networking;
using UnityEngine;
namespace ProjectWolves.Weapons
{
public class NetworkProjectile : MonoBehaviour
{
public uint ProjectileId { get; set; }
public uint LocalId { get; set; }
@James-Frowen
James-Frowen / SendImage.cs
Last active June 26, 2020 21:17
Script to send image over multiple packets
using System;
using System.Collections;
using System.IO;
using Mirror;
using UnityEngine;
namespace ScreenShotDemo
{
public class SendImage : MonoBehaviour
{
@James-Frowen
James-Frowen / SerializedEditorWindow.cs
Last active March 25, 2019 16:43
Base Class for editor windows in Unity3d
using UnityEditor;
using UnityEngine;
namespace EditorScripts
{
public abstract class SerializedEditorWindow : EditorWindow
{
/// <summary>
/// Serialization target, can be overridden to allow target to be something other than this editor window
/// </summary>