Skip to content

Instantly share code, notes, and snippets.

View James-Frowen's full-sized avatar

James Frowen James-Frowen

View GitHub Profile

What do each Objectives and Outcomes do

The "Mission Start" objective is the entry point for the mission, it is created automatically and can not be removed. It should be used to start the first real objectives for your mission. Objectives will not be started unless you use the Start Objective Outcome.

When an objective is complete, all outcomes for that objective will be triggered.

If units are not in any Spawn Unit Outcome they will be spawned when mission starts instead.

Objectives

None

@James-Frowen
James-Frowen / BetterToggleGroup.cs
Last active December 9, 2023 18:40
Better Toggle group because the built in Toggle group in unity is useless
// MIT License - Copyright (c) 2023, James Frowen
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BetterToggleGroup : MonoBehaviour
{
public delegate void ToggleIndexOn(int index);
[SerializeField] private int currentValue;
@James-Frowen
James-Frowen / MirrorPrefabPool.cs
Last active November 2, 2023 03:25
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;
@James-Frowen
James-Frowen / NetworkTransportDrawer.cs
Created August 11, 2023 13:54
popup to add transports to Mirror's networkmanager
[CustomPropertyDrawer(typeof(Transport))]
public class NetworkTransportDrawer: PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var fieldRect = position;
var buttonRect = position;
fieldRect.width -= 50;
buttonRect.xMin = fieldRect.xMax;
@James-Frowen
James-Frowen / ExampleInterface.cs
Last active July 20, 2023 15:07
Unity3d, How to show an interface field in Inspector
namespace JamesFrowen
{
public interface ISomeInterface
{
void SomeMethod();
}
[System.Serializable]
public class SomeInterfaceWrapper : InterfaceWrapper<ISomeInterface>
{
| Name | Description | time | method | | | | |
| | | Mean | Ratio | StdDev | StdError | min | max |
|----------|--------------------|-----------|--------|-----------|----------|-----------|------------|
| Method 1 | .net7 release | 13.503 us | | 8.782 us | 0.051 us | 7.230 us | 93.239 us |
| Method 1 | .net7 debug | 17.424 us | | 2.922 us | 0.017 us | 14.713 us | 33.308 us |
| Method 1 | unity 2022 release | 18.569 us | | 1.231 us | 0.007 us | 16.673 us | 23.667 us |
| Method 1 | unity 2020 release | 20.213 us | | 13.740 us | 0.079 us | 17.043 us | 220.575 us |
| Method 1 | unity 2020 debug | 23.255 us | | 1.762 us | 0.010 us | 20.754 us | 33.642 us |
| Method 1 | unity 2022 debug | 23.478 us | | 12.544 us | 0.072 us | 20.624 us | 235.884 us |
| | | | | | | |
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 / PositionCompression.cs
Last active October 1, 2022 16:30
Write/Read Compressed Vector3 for mirror
public class PositionCompression
{
public struct CompressFloat
{
public readonly float minFloat;
public readonly float maxFloat;
public readonly uint minUint;
public readonly uint maxUint;
# 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
/*
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