Skip to content

Instantly share code, notes, and snippets.

@tsubaki
tsubaki / LoadAssetbundle.cs
Last active Mar 16, 2019
AssetBundleを復号してロードする
View LoadAssetbundle.cs
using System.Collections;
using UnityEngine;
using System.IO;
using System.Text;
public class LoadAssetbundle : MonoBehaviour
{
AssetBundle bundle;
FileStream fileStream;
@tsubaki
tsubaki / AssetBundleBuilder.cs
Created Mar 16, 2019
暗号化したAssetBundleを生成
View AssetBundleBuilder.cs
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Text;
public class AssetBundleBuilder
{
const string password = "password";
[MenuItem("Assets/Build")]
View SeekableAesStream.cs
// original : https://stackoverflow.com/a/38974483
public class SeekableAesStream : Stream
{
private Stream baseStream;
private AesManaged aes;
private ICryptoTransform encryptor;
public bool autoDisposeBaseStream { get; set; } = true;
/// <param name="salt">//** WARNING **: MUST be unique for each stream otherwise there is NO security</param>
@tsubaki
tsubaki / DistanceCheckSystem.cs
Created Mar 10, 2019
RequireForUpdateの例
View DistanceCheckSystem.cs
using UnityEngine;
using Unity.Entities;
using Unity.Transforms;
using Unity.Mathematics;
using Unity.Collections;
public class DistanceCheckSystem : ComponentSystem
{
ComponentGroup itemGroup, aiGroup;
View SwapCharacter.cs
using UnityEngine;
using UnityEngine.AddressableAssets;
public class SwapCharacter : MonoBehaviour
{
[SerializeField] Animator parentAnimator; // 登録するAnimator
private GameObject cacheCharacter; // 差し替え時に元オブジェクトを削除する用
public void Load(string characterName)
@tsubaki
tsubaki / Sample.cs
Last active Mar 1, 2019
ResourceManagerの超小さい例
View Sample.cs
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.ResourceManagement;
class Sample : MonoBehaviour
{
void Start()
{
// 初期化
View TagProvider.cs
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.QuickSearch;
using UnityEngine;
using System;
using UnityEditor;
using UnityEditorInternal;
public class TagProvider : MonoBehaviour
View NativeListExample.cs
using UnityEngine;
using Unity.Collections;
using Unity.Jobs;
public class NativeListExample : MonoBehaviour
{
JobHandle handle;
NativeQueue<int> queue;
NativeList<int> list;
View NewComponentDataArrayWithJobSampleSystem.cs
using Unity.Entities;
using Unity.Transforms;
using Unity.Collections;
using Unity.Mathematics;
using Unity.Jobs;
public class NewComponentDataArrayWithJobSampleSystem : JobComponentSystem
{
ComponentGroup playerGroup, enemyGroup;
View NewComponentDataArraySampleSystem.cs
using Unity.Entities;
using Unity.Transforms;
using Unity.Collections;
using Unity.Mathematics;
public class NewComponentDataArraySampleSystem : ComponentSystem
{
ComponentGroup playerGroup, enemyGroup;
protected override void OnCreateManager()
You can’t perform that action at this time.