Compare commits
9 Commits
c5f0f63efa
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fba35a0a2 | |||
| 102b4fb7bf | |||
| 0dc0896291 | |||
| 1524422b09 | |||
|
|
fdab098562 | ||
| e9f627662c | |||
| 1cd8d611e2 | |||
| 03086fab06 | |||
| 294033268a |
40
.github/workflows/create-release.yml
vendored
Normal file
40
.github/workflows/create-release.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Create Unity package from repo
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Release version (e.g. 1.0.0)'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build-package:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Unity package folder
|
||||
run: |
|
||||
mkdir -p package
|
||||
rsync -av --exclude='*.meta' Assets/Pacore/ package/
|
||||
|
||||
|
||||
- name: Create tarball
|
||||
run: |
|
||||
VERSION=${{ github.event.inputs.version }}
|
||||
PACKAGE_NAME="com.pashabibko.pacore-${VERSION}.tgz"
|
||||
tar -czf "$PACKAGE_NAME" package
|
||||
ls -1h "$PACKAGE_NAME"
|
||||
|
||||
- name: Create Github Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ github.event.inputs.version }}
|
||||
name: Release ${{ github.event.inputs.version }}
|
||||
body: "Automated release of Pacore package"
|
||||
artifacts: "com.pashabibko.pacore-${{ github.event.inputs.version }}.tgz"
|
||||
draft: false
|
||||
prerelease: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -22,8 +22,9 @@
|
||||
# Uncomment this line if you wish to ignore the asset store tools plugin
|
||||
# /[Aa]ssets/AssetStoreTools*
|
||||
|
||||
# Autogenerated Jetbrains Rider plugin
|
||||
# Rider files
|
||||
/[Aa]ssets/Plugins/Editor/JetBrains*
|
||||
/.idea/
|
||||
|
||||
# Visual Studio cache directory
|
||||
.vs/
|
||||
|
||||
15
.idea/.idea.Pacore/.idea/.gitignore
generated
vendored
15
.idea/.idea.Pacore/.idea/.gitignore
generated
vendored
@@ -1,15 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/contentModel.xml
|
||||
/.idea.Pacore.iml
|
||||
/modules.xml
|
||||
/projectSettingsUpdater.xml
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
4
.idea/.idea.Pacore/.idea/encodings.xml
generated
4
.idea/.idea.Pacore/.idea/encodings.xml
generated
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
8
.idea/.idea.Pacore/.idea/indexLayout.xml
generated
8
.idea/.idea.Pacore/.idea/indexLayout.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.Pacore/.idea/vcs.xml
generated
6
.idea/.idea.Pacore/.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
8
Assets/Pacore/Runtime/MemUtil.meta
Normal file
8
Assets/Pacore/Runtime/MemUtil.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9b64dde6eaaefc498098e1b5641cb52
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
82
Assets/Pacore/Runtime/MemUtil/Unique.cs
Normal file
82
Assets/Pacore/Runtime/MemUtil/Unique.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Diagnostics;
|
||||
using Unity.Collections;
|
||||
using System;
|
||||
|
||||
namespace PashaBibko.Pacore.MemUtil
|
||||
{
|
||||
public unsafe struct Unique<T> : IDisposable
|
||||
where T : unmanaged
|
||||
{
|
||||
private T* mPtr;
|
||||
|
||||
public bool IsValid
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => mPtr != null;
|
||||
}
|
||||
|
||||
public T Value
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
DebugOnly_CheckValid();
|
||||
return *mPtr;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
DebugOnly_CheckValid();
|
||||
*mPtr = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ref T Ref
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
DebugOnly_CheckValid();
|
||||
return ref *mPtr;
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Unique<T> Create(T val = default)
|
||||
{
|
||||
T* ptr = (T*)UnsafeUtility.Malloc
|
||||
(
|
||||
sizeof(T),
|
||||
UnsafeUtility.SizeOf<T>(),
|
||||
Allocator.Persistent
|
||||
);
|
||||
*ptr = val;
|
||||
|
||||
return new Unique<T> { mPtr = ptr };
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsValid)
|
||||
{
|
||||
UnsafeUtility.Free(mPtr, Allocator.Persistent);
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR")]
|
||||
private void DebugOnly_CheckValid()
|
||||
{
|
||||
if (!IsValid)
|
||||
{
|
||||
throw new InvalidOperationException
|
||||
(
|
||||
$"Owned<{nameof(T)}> was expected to be valid."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Pacore/Runtime/MemUtil/Unique.cs.meta
Normal file
11
Assets/Pacore/Runtime/MemUtil/Unique.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4ac012a56e2aa9429ff4f33c5554e7d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -4,7 +4,7 @@
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"allowUnsafeCode": true,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.pashabibko.pacore",
|
||||
"displayName": "Pacore",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.1-alpha",
|
||||
"unity": "2022.3",
|
||||
"description" : "Small Unity Util library",
|
||||
"keywords": [ "tool", "script", "runtime" ],
|
||||
|
||||
Reference in New Issue
Block a user