Compare commits
No commits in common. "v2.3.3-pre.1" and "release" have entirely different histories.
v2.3.3-pre
...
release
Runtime/Scripts
Controls/ReorderableList
Effects
Primitives
Utilities
|
@ -25,11 +25,11 @@ jobs:
|
||||||
- name: Script Version
|
- name: Script Version
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Script Versioning"
|
echo "::group::Script Versioning"
|
||||||
$scriptVersion = "1.0.1"
|
$scriptVersion = "1.0.0"
|
||||||
echo "Build Script Version: $scriptVersion"
|
echo "Build Script Version: $scriptVersion"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
clean: true
|
clean: true
|
||||||
|
|
|
@ -64,30 +64,26 @@ jobs:
|
||||||
unityVersion: 2022.3
|
unityVersion: 2022.3
|
||||||
build-target: WSAPlayer
|
build-target: WSAPlayer
|
||||||
- os: windows
|
- os: windows
|
||||||
unityVersion: 6000.0
|
unityVersion: 2023.1
|
||||||
build-target: Android
|
build-target: Android
|
||||||
|
- os: macOS
|
||||||
|
unityVersion: 2023.1
|
||||||
|
build-target: iOS
|
||||||
- os: windows
|
- os: windows
|
||||||
unityVersion: 6000.0
|
unityVersion: 2023.1
|
||||||
build-target: StandaloneWindows64
|
build-target: StandaloneWindows64
|
||||||
- os: windows
|
- os: windows
|
||||||
unityVersion: 6000.0
|
unityVersion: 2023.1
|
||||||
build-target: WSAPlayer
|
build-target: WSAPlayer
|
||||||
- os: macos
|
|
||||||
unityVersion: 6000.0
|
|
||||||
build-target: iOS
|
|
||||||
- os: macos
|
|
||||||
unityVersion: 6000.0
|
|
||||||
build-target: StandaloneOSX
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Script Version
|
- name: Script Version
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Script Versioning"
|
echo "::group::Script Versioning"
|
||||||
$scriptVersion = "1.0.1"
|
$scriptVersion = "1.0.0"
|
||||||
echo "Build Script Version: $scriptVersion"
|
echo "Build Script Version: $scriptVersion"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
clean: true
|
clean: true
|
||||||
|
@ -95,8 +91,8 @@ jobs:
|
||||||
- id: build
|
- id: build
|
||||||
name: 'Run Unity Builds'
|
name: 'Run Unity Builds'
|
||||||
run: |
|
run: |
|
||||||
|
echo "::group::Set Hub and editor locations"
|
||||||
$unityVersion = '${{ matrix.unityVersion }}'
|
$unityVersion = '${{ matrix.unityVersion }}'
|
||||||
$unityMajorVersion = $unityVersion.Substring(0, 4)
|
|
||||||
|
|
||||||
echo "::group::Set Hub and editor locations"
|
echo "::group::Set Hub and editor locations"
|
||||||
|
|
||||||
|
@ -104,46 +100,43 @@ jobs:
|
||||||
if ( (-not $global:PSVersionTable.Platform) -or ($global:PSVersionTable.Platform -eq "Win32NT") )
|
if ( (-not $global:PSVersionTable.Platform) -or ($global:PSVersionTable.Platform -eq "Win32NT") )
|
||||||
{
|
{
|
||||||
$hubPath = "C:\Program Files\Unity Hub\Unity Hub.exe"
|
$hubPath = "C:\Program Files\Unity Hub\Unity Hub.exe"
|
||||||
|
$editorRootPath = "C:\Program Files\Unity\Hub\Editor\"
|
||||||
|
$editorFileEx = "\Editor\Unity.exe"
|
||||||
|
$directorySeparatorChar = "\"
|
||||||
|
|
||||||
#"Unity Hub.exe" -- --headless help
|
#"Unity Hub.exe" -- --headless help
|
||||||
#. 'C:\Program Files\Unity Hub\Unity Hub.exe' -- --headless help
|
#. 'C:\Program Files\Unity Hub\Unity Hub.exe' -- --headless help
|
||||||
function unity-hub
|
function unity-hub
|
||||||
{
|
|
||||||
& $hubPath -- --headless $args.Split(" ") | Out-String
|
|
||||||
}
|
|
||||||
function unity-hub-raw
|
|
||||||
{
|
{
|
||||||
& $hubPath -- --headless $args.Split(" ") | Out-String -NoNewline
|
& $hubPath -- --headless $args.Split(" ") | Out-String -NoNewline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ( $global:PSVersionTable.OS.Contains("Darwin") )
|
elseif ( $global:PSVersionTable.OS.Contains("Darwin") )
|
||||||
{
|
{
|
||||||
$hubPath = "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
|
$hubPath = "/Applications/Unity Hub.app/Contents/macOS/Unity Hub"
|
||||||
|
$editorRootPath = "/Applications/Unity/Hub/Editor/"
|
||||||
|
$editorFileEx = "/Unity.app/Contents/macOS/Unity"
|
||||||
|
$directorySeparatorChar = "/"
|
||||||
|
|
||||||
# /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
|
# /Applications/Unity\ Hub.app/Contents/macOS/Unity\ Hub -- --headless help
|
||||||
function unity-hub
|
function unity-hub
|
||||||
{
|
|
||||||
& $hubPath -- --headless $args.Split(" ") | Out-String
|
|
||||||
}
|
|
||||||
function unity-hub-raw
|
|
||||||
{
|
{
|
||||||
& $hubPath -- --headless $args.Split(" ") | Out-String -NoNewline
|
& $hubPath -- --headless $args.Split(" ") | Out-String -NoNewline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ( $global:PSVersionTable.OS.Contains("Linux") )
|
elseif ( $global:PSVersionTable.OS.Contains("Linux") )
|
||||||
{
|
{
|
||||||
$hubPath = "$HOME/Unity Hub/UnityHub.AppImage"
|
$hubPath = "$HOME/Unity Hub/UnityHub.AppImage"
|
||||||
|
$editorRootPath = "$HOME/Unity/Hub/Editor/"
|
||||||
|
$editorFileEx = "/Editor/Unity"
|
||||||
|
$directorySeparatorChar = "/"
|
||||||
|
|
||||||
# /UnityHub.AppImage --headless help
|
# /UnityHub.AppImage --headless help
|
||||||
# xvfb-run --auto-servernum "$HOME/Unity Hub/UnityHub.AppImage" --headless help
|
# xvfb-run --auto-servernum "$HOME/Unity Hub/UnityHub.AppImage" --headless help
|
||||||
function unity-hub
|
function unity-hub
|
||||||
{
|
{
|
||||||
xvfb-run --auto-servernum "$hubPath" --headless $args.Split(" ")
|
xvfb-run --auto-servernum "$hubPath" --headless $args.Split(" ")
|
||||||
}
|
}
|
||||||
function unity-hub-raw
|
|
||||||
{
|
|
||||||
xvfb-run --auto-servernum "$hubPath" --headless $args.Split(" ")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
@ -175,7 +168,7 @@ jobs:
|
||||||
echo "Requested unity version is {$unityVersion}"
|
echo "Requested unity version is {$unityVersion}"
|
||||||
|
|
||||||
$InstalledUnityVersions = unity-hub editors
|
$InstalledUnityVersions = unity-hub editors
|
||||||
$editorRootPath = unity-hub-raw ip -g
|
$editorRootPath = unity-hub ip -g
|
||||||
echo "Installed unity versions are {$InstalledUnityVersions}"
|
echo "Installed unity versions are {$InstalledUnityVersions}"
|
||||||
echo "Unity install path is {$editorRootPath}"
|
echo "Unity install path is {$editorRootPath}"
|
||||||
|
|
||||||
|
@ -237,7 +230,7 @@ jobs:
|
||||||
}
|
}
|
||||||
elseif ( $global:PSVersionTable.OS.Contains("Darwin") ) {
|
elseif ( $global:PSVersionTable.OS.Contains("Darwin") ) {
|
||||||
echo 'Building using Mac'
|
echo 'Building using Mac'
|
||||||
$editorFileEx = "/Unity.app/Contents/MacOS/Unity"
|
$editorFileEx = "/Unity.app/Contents/macOS/Unity"
|
||||||
$editorrunpath = Join-Path $editorRootPath $unityVersion $editorFileEx
|
$editorrunpath = Join-Path $editorRootPath $unityVersion $editorFileEx
|
||||||
|
|
||||||
function unity-editor {
|
function unity-editor {
|
||||||
|
@ -274,7 +267,7 @@ jobs:
|
||||||
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Setup logging and run Unit tests"
|
echo "::group::Setup logging and run Unit tests"
|
||||||
|
|
||||||
# Log detail
|
# Log detail
|
||||||
$logDirectory = "Logs"
|
$logDirectory = "Logs"
|
||||||
|
@ -290,13 +283,14 @@ jobs:
|
||||||
|
|
||||||
# If run manually, the Refname is actually blank, so just use date
|
# If run manually, the Refname is actually blank, so just use date
|
||||||
if([string]::IsNullOrEmpty(${GITHUB_REF_NAME})) {
|
if([string]::IsNullOrEmpty(${GITHUB_REF_NAME})) {
|
||||||
$logName = Join-Path $logDirectory $date
|
$logName = "$logDirectory$directorySeparatorChar$date"
|
||||||
}else {
|
}
|
||||||
$logName = Join-Path $logDirectory ${GITHUB_REF_NAME}-$date
|
else{
|
||||||
|
$logName = "$logDirectory$directorySeparatorChar${GITHUB_REF_NAME}-$date"
|
||||||
}
|
}
|
||||||
|
|
||||||
$logPath = "$unityMajorVersion_${{ matrix.build-target }}_$logName.log"
|
$logPath = "$logName.log"
|
||||||
$testsLogPath = "$unityMajorVersion_${{ matrix.build-target }}_$logName-tests.xml"
|
$testsLogPath = "$logName-tests.xml"
|
||||||
|
|
||||||
echo "Logpath [$logPath]"
|
echo "Logpath [$logPath]"
|
||||||
echo "TestsPath [$testsLogPath]"
|
echo "TestsPath [$testsLogPath]"
|
||||||
|
@ -319,20 +313,9 @@ jobs:
|
||||||
|
|
||||||
$TempUnityProjectName = 'P'
|
$TempUnityProjectName = 'P'
|
||||||
|
|
||||||
unity-editor '-createProject' $TempUnityProjectName '-logFile' $logPath '-quit'
|
unity-editor '-createProject' $TempUnityProjectName -quit
|
||||||
|
|
||||||
if ( -not (Test-Path "$TempUnityProjectName") )
|
$destinationPath = $TempUnityProjectName + $directorySeparatorChar + 'packages'
|
||||||
{
|
|
||||||
$ProjectPath = Get-Location
|
|
||||||
Write-Error "Editor failed to create project not Found $ProjectPath/$TempUnityProjectName"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$ProjectPath = Get-Location
|
|
||||||
echo "Editor project created at $ProjectPath/$TempUnityProjectName"
|
|
||||||
}
|
|
||||||
|
|
||||||
$destinationPath = Join-Path $TempUnityProjectName 'packages'
|
|
||||||
Move-Item -Path $UPMFolderName -Destination $destinationPath
|
Move-Item -Path $UPMFolderName -Destination $destinationPath
|
||||||
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
@ -365,9 +348,10 @@ jobs:
|
||||||
# Read dependancy input value
|
# Read dependancy input value
|
||||||
$dependencies = '${{ inputs.dependencies }}'
|
$dependencies = '${{ inputs.dependencies }}'
|
||||||
|
|
||||||
if([string]::IsNullOrEmpty('${{ github.actor }}') -or [string]::IsNullOrEmpty('${{ secrets.GITHUB_TOKEN }}')){
|
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}') -or [string]::IsNullOrEmpty('${{ secrets.GIT_PAT }}')){
|
||||||
echo ""
|
echo ""
|
||||||
echo "Insufficient credentials supplied to activate the workflow"
|
echo "Secrets for GIT_USER_NAME or GIT_PAT missing, please register them with access to this runner"
|
||||||
|
echo "*Note, Organisation secrets are not accessible to Forked repos and need registering in the local fork"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +362,7 @@ jobs:
|
||||||
echo $JSONdependencies
|
echo $JSONdependencies
|
||||||
|
|
||||||
# Read current Manifest json
|
# Read current Manifest json
|
||||||
$manifestPath = Join-Path $destinationPath 'manifest.json'
|
$manifestPath = $destinationPath + $directorySeparatorChar + 'manifest.json'
|
||||||
$projectManifest = Get-Content -Path $manifestPath | ConvertFrom-Json
|
$projectManifest = Get-Content -Path $manifestPath | ConvertFrom-Json
|
||||||
$strArray = $projectManifest.dependencies.PsObject.Properties | ForEach-Object {"$($_.Name)@$($_.Value),"}
|
$strArray = $projectManifest.dependencies.PsObject.Properties | ForEach-Object {"$($_.Name)@$($_.Value),"}
|
||||||
|
|
||||||
|
@ -391,7 +375,7 @@ jobs:
|
||||||
$dependencyURL = $_.Value
|
$dependencyURL = $_.Value
|
||||||
echo "---------------------------------------------"
|
echo "---------------------------------------------"
|
||||||
echo "Cloning dependency - Name [$dependencyName] - Path [$dependencyPath] - URL [$dependencyURL]"
|
echo "Cloning dependency - Name [$dependencyName] - Path [$dependencyPath] - URL [$dependencyURL]"
|
||||||
$cloneURL = "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@$dependencyURL"
|
$cloneURL = "https://${{ secrets.GIT_USER_NAME }}:${{ secrets.GIT_PAT }}@$dependencyURL"
|
||||||
|
|
||||||
echo "cloning $dependencyName from $dependencyURL and moving to $destinationPath"
|
echo "cloning $dependencyName from $dependencyURL and moving to $destinationPath"
|
||||||
echo "git path - $cloneURL"
|
echo "git path - $cloneURL"
|
||||||
|
@ -447,7 +431,7 @@ jobs:
|
||||||
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Run build"
|
echo "::group::Run build"
|
||||||
|
|
||||||
echo "---------------------------------------------"
|
echo "---------------------------------------------"
|
||||||
echo "Start Testing"
|
echo "Start Testing"
|
||||||
|
@ -477,10 +461,11 @@ jobs:
|
||||||
|
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
}
|
}
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: unity-build-log-${{ matrix.unityVersion }}-${{ matrix.build-target }}
|
name: unity-build-log
|
||||||
path: Logs/**
|
path: Logs/**
|
|
@ -32,17 +32,18 @@ jobs:
|
||||||
- name: Script Version
|
- name: Script Version
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Script Versioning"
|
echo "::group::Script Versioning"
|
||||||
$scriptVersion = "1.0.1"
|
$scriptVersion = "1.0.0"
|
||||||
echo "Build Script Version: $scriptVersion"
|
echo "Build Script Version: $scriptVersion"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
clean: true
|
clean: true
|
||||||
- id: build
|
- id: build
|
||||||
name: 'Run Unity Builds'
|
name: 'Run Unity Builds'
|
||||||
run: |
|
run: |
|
||||||
|
echo "::group::Set Hub and editor locations"
|
||||||
$unityVersion = '${{ inputs.unityVersion }}'
|
$unityVersion = '${{ inputs.unityVersion }}'
|
||||||
|
|
||||||
echo "::group::Set Hub and editor locations"
|
echo "::group::Set Hub and editor locations"
|
||||||
|
@ -52,6 +53,8 @@ jobs:
|
||||||
{
|
{
|
||||||
$hubPath = "C:\Program Files\Unity Hub\Unity Hub.exe"
|
$hubPath = "C:\Program Files\Unity Hub\Unity Hub.exe"
|
||||||
$editorRootPath = "C:\Program Files\Unity\Hub\Editor\"
|
$editorRootPath = "C:\Program Files\Unity\Hub\Editor\"
|
||||||
|
$editorFileEx = "\Editor\Unity.exe"
|
||||||
|
$directorySeparatorChar = "\"
|
||||||
|
|
||||||
#"Unity Hub.exe" -- --headless help
|
#"Unity Hub.exe" -- --headless help
|
||||||
#. 'C:\Program Files\Unity Hub\Unity Hub.exe' -- --headless help
|
#. 'C:\Program Files\Unity Hub\Unity Hub.exe' -- --headless help
|
||||||
|
@ -64,6 +67,8 @@ jobs:
|
||||||
{
|
{
|
||||||
$hubPath = "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
|
$hubPath = "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
|
||||||
$editorRootPath = "/Applications/Unity/Hub/Editor/"
|
$editorRootPath = "/Applications/Unity/Hub/Editor/"
|
||||||
|
$editorFileEx = "/Unity.app/Contents/MacOS/Unity"
|
||||||
|
$directorySeparatorChar = "/"
|
||||||
|
|
||||||
# /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
|
# /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
|
||||||
function unity-hub
|
function unity-hub
|
||||||
|
@ -75,6 +80,8 @@ jobs:
|
||||||
{
|
{
|
||||||
$hubPath = "$HOME/Unity Hub/UnityHub.AppImage"
|
$hubPath = "$HOME/Unity Hub/UnityHub.AppImage"
|
||||||
$editorRootPath = "$HOME/Unity/Hub/Editor/"
|
$editorRootPath = "$HOME/Unity/Hub/Editor/"
|
||||||
|
$editorFileEx = "/Editor/Unity"
|
||||||
|
$directorySeparatorChar = "/"
|
||||||
|
|
||||||
# /UnityHub.AppImage --headless help
|
# /UnityHub.AppImage --headless help
|
||||||
# xvfb-run --auto-servernum "$HOME/Unity Hub/UnityHub.AppImage" --headless help
|
# xvfb-run --auto-servernum "$HOME/Unity Hub/UnityHub.AppImage" --headless help
|
||||||
|
@ -228,9 +235,10 @@ jobs:
|
||||||
|
|
||||||
# If run manually, the Refname is actually blank, so just use date
|
# If run manually, the Refname is actually blank, so just use date
|
||||||
if([string]::IsNullOrEmpty(${GITHUB_REF_NAME})) {
|
if([string]::IsNullOrEmpty(${GITHUB_REF_NAME})) {
|
||||||
$logName = Join-Path $logDirectory $date
|
$logName = "$logDirectory$directorySeparatorChar$date"
|
||||||
}else {
|
}
|
||||||
$logName = Join-Path $logDirectory ${GITHUB_REF_NAME}-$date
|
else{
|
||||||
|
$logName = "$logDirectory$directorySeparatorChar${GITHUB_REF_NAME}-$date"
|
||||||
}
|
}
|
||||||
|
|
||||||
$logPath = "$logName.log"
|
$logPath = "$logName.log"
|
||||||
|
@ -257,20 +265,9 @@ jobs:
|
||||||
|
|
||||||
$TempUnityProjectName = 'P'
|
$TempUnityProjectName = 'P'
|
||||||
|
|
||||||
unity-editor '-createProject' $TempUnityProjectName '-logFile' $logPath '-quit'
|
unity-editor '-createProject' $TempUnityProjectName -quit
|
||||||
|
|
||||||
if ( -not (Test-Path "$TempUnityProjectName") )
|
$destinationPath = $TempUnityProjectName + $directorySeparatorChar + 'packages'
|
||||||
{
|
|
||||||
$ProjectPath = Get-Location
|
|
||||||
Write-Error "Editor failed to create project not Found $ProjectPath/$TempUnityProjectName"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$ProjectPath = Get-Location
|
|
||||||
echo "Editor project created at $ProjectPath/$TempUnityProjectName"
|
|
||||||
}
|
|
||||||
|
|
||||||
$destinationPath = Join-Path $TempUnityProjectName 'packages'
|
|
||||||
Move-Item -Path $UPMFolderName -Destination $destinationPath
|
Move-Item -Path $UPMFolderName -Destination $destinationPath
|
||||||
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
@ -303,9 +300,10 @@ jobs:
|
||||||
# Read dependancy input value
|
# Read dependancy input value
|
||||||
$dependencies = '${{ inputs.dependencies }}'
|
$dependencies = '${{ inputs.dependencies }}'
|
||||||
|
|
||||||
if([string]::IsNullOrEmpty('${{ github.actor }}') -or [string]::IsNullOrEmpty('${{ secrets.GITHUB_TOKEN }}')){
|
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}') -or [string]::IsNullOrEmpty('${{ secrets.GIT_PAT }}')){
|
||||||
echo ""
|
echo ""
|
||||||
echo "Insufficient credentials supplied to activate the workflow"
|
echo "Secrets for GIT_USER_NAME or GIT_PAT missing, please register them with access to this runner"
|
||||||
|
echo "*Note, Organisation secrets are not accessible to Forked repos and need registering in the local fork"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +314,7 @@ jobs:
|
||||||
echo $JSONdependencies
|
echo $JSONdependencies
|
||||||
|
|
||||||
# Read current Manifest json
|
# Read current Manifest json
|
||||||
$manifestPath = Join-Path $destinationPath 'manifest.json'
|
$manifestPath = $destinationPath + $directorySeparatorChar + 'manifest.json'
|
||||||
$projectManifest = Get-Content -Path $manifestPath | ConvertFrom-Json
|
$projectManifest = Get-Content -Path $manifestPath | ConvertFrom-Json
|
||||||
$strArray = $projectManifest.dependencies.PsObject.Properties | ForEach-Object {"$($_.Name)@$($_.Value),"}
|
$strArray = $projectManifest.dependencies.PsObject.Properties | ForEach-Object {"$($_.Name)@$($_.Value),"}
|
||||||
|
|
||||||
|
@ -329,7 +327,7 @@ jobs:
|
||||||
$dependencyURL = $_.Value
|
$dependencyURL = $_.Value
|
||||||
echo "---------------------------------------------"
|
echo "---------------------------------------------"
|
||||||
echo "Cloning dependency - Name [$dependencyName] - Path [$dependencyPath] - URL [$dependencyURL]"
|
echo "Cloning dependency - Name [$dependencyName] - Path [$dependencyPath] - URL [$dependencyURL]"
|
||||||
$cloneURL = "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@$dependencyURL"
|
$cloneURL = "https://${{ secrets.GIT_USER_NAME }}:${{ secrets.GIT_PAT }}@$dependencyURL"
|
||||||
|
|
||||||
echo "cloning $dependencyName from $dependencyURL and moving to $destinationPath"
|
echo "cloning $dependencyName from $dependencyURL and moving to $destinationPath"
|
||||||
echo "git path - $cloneURL"
|
echo "git path - $cloneURL"
|
||||||
|
@ -415,10 +413,11 @@ jobs:
|
||||||
|
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
}
|
}
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v3
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: unity-build-log-${{ matrix.build-target }}
|
name: unity-build-log
|
||||||
path: Logs/**
|
path: Logs/**
|
|
@ -27,17 +27,17 @@ jobs:
|
||||||
- name: Script Version
|
- name: Script Version
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Script Versioning"
|
echo "::group::Script Versioning"
|
||||||
$scriptVersion = "1.0.3"
|
$scriptVersion = "1.0.2"
|
||||||
echo "Build Script Version: $scriptVersion"
|
echo "Build Script Version: $scriptVersion"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
clean: true
|
clean: true
|
||||||
token: ${{ secrets.GIT_PAT }}
|
token: ${{ secrets.GIT_PAT }}
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
- name: Set Github vars
|
- name: Set Github vars
|
||||||
run: |
|
run: |
|
||||||
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}')){
|
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}')){
|
||||||
|
@ -74,6 +74,6 @@ jobs:
|
||||||
- name: Create tag and push
|
- name: Create tag and push
|
||||||
run: |
|
run: |
|
||||||
$tagVersion = "${{ inputs.version }}"
|
$tagVersion = "${{ inputs.version }}"
|
||||||
git tag -fa "v$tagVersion" -m "v$tagVersion Release [skip ci]"
|
git tag -fa "v$tagVersion" "${GITHUB_SHA}" -m "v$tagVersion Release [skip ci]"
|
||||||
git push origin "v$tagVersion" --force
|
git push origin "v$tagVersion" --force
|
||||||
shell: pwsh
|
shell: pwsh
|
|
@ -31,8 +31,8 @@ on:
|
||||||
description: "Returns the version of Unity the UPM package requires"
|
description: "Returns the version of Unity the UPM package requires"
|
||||||
value: ${{ jobs.packageRelease.outputs.packageversion }}
|
value: ${{ jobs.packageRelease.outputs.packageversion }}
|
||||||
secrets:
|
secrets:
|
||||||
GIT_USER_NAME:
|
GIT_PAT:
|
||||||
required: false
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
packageRelease:
|
packageRelease:
|
||||||
|
@ -44,18 +44,18 @@ jobs:
|
||||||
- name: Script Version
|
- name: Script Version
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Script Versioning"
|
echo "::group::Script Versioning"
|
||||||
$scriptVersion = "1.0.3"
|
$scriptVersion = "1.0.2"
|
||||||
echo "Build Script Version: $scriptVersion"
|
echo "Build Script Version: $scriptVersion"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.target-branch }}
|
ref: ${{ inputs.target-branch }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
clean: true
|
clean: true
|
||||||
token: ${{ secrets.GIT_PAT }}
|
token: ${{ secrets.GIT_PAT }}
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v3
|
||||||
- name: Set Github vars
|
- name: Set Github vars
|
||||||
run: |
|
run: |
|
||||||
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}')){
|
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}')){
|
||||||
|
@ -176,6 +176,6 @@ jobs:
|
||||||
if: ${{inputs.createTag == true}}
|
if: ${{inputs.createTag == true}}
|
||||||
run: |
|
run: |
|
||||||
$outputVersion = '${{steps.getpackageversion.outputs.packageversion }}'
|
$outputVersion = '${{steps.getpackageversion.outputs.packageversion }}'
|
||||||
git tag -fa "v$outputVersion" -m "v$outputVersion Release"
|
git tag -fa "v$outputVersion" "${GITHUB_SHA}" -m "v$outputVersion Release"
|
||||||
git push origin "v$outputVersion" --force --tags
|
git push origin "v$outputVersion" --force --tags
|
||||||
shell: pwsh
|
shell: pwsh
|
|
@ -32,9 +32,6 @@ namespace UnityEngine.UI.Extensions
|
||||||
[Tooltip("Should items being dragged over this list have their sizes equalized?")]
|
[Tooltip("Should items being dragged over this list have their sizes equalized?")]
|
||||||
public bool EqualizeSizesOnDrag = false;
|
public bool EqualizeSizesOnDrag = false;
|
||||||
|
|
||||||
[Tooltip("Should items keep the original rotation?")]
|
|
||||||
public bool KeepItemRotation = false;
|
|
||||||
|
|
||||||
[Tooltip("Maximum number of items this container can hold")]
|
[Tooltip("Maximum number of items this container can hold")]
|
||||||
public int maxItems = int.MaxValue;
|
public int maxItems = int.MaxValue;
|
||||||
|
|
||||||
|
|
|
@ -266,10 +266,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
_displacedObjectLE.preferredWidth = _draggingObjectOriginalSize.x;
|
_displacedObjectLE.preferredWidth = _draggingObjectOriginalSize.x;
|
||||||
_displacedObjectLE.preferredHeight = _draggingObjectOriginalSize.y;
|
_displacedObjectLE.preferredHeight = _draggingObjectOriginalSize.y;
|
||||||
_displacedObject.SetParent(_reorderableList.Content, false);
|
_displacedObject.SetParent(_reorderableList.Content, false);
|
||||||
if (!_reorderableList.KeepItemRotation)
|
_displacedObject.rotation = _reorderableList.transform.rotation;
|
||||||
{
|
|
||||||
_displacedObject.rotation = _reorderableList.transform.rotation;
|
|
||||||
}
|
|
||||||
_displacedObject.SetSiblingIndex(_fromIndex);
|
_displacedObject.SetSiblingIndex(_fromIndex);
|
||||||
// Force refreshing both lists because otherwise we get inappropriate FromList in ReorderableListEventStruct
|
// Force refreshing both lists because otherwise we get inappropriate FromList in ReorderableListEventStruct
|
||||||
_reorderableList.Refresh();
|
_reorderableList.Refresh();
|
||||||
|
@ -313,10 +310,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
_displacedObjectLE.preferredWidth = _displacedObjectOriginalSize.x;
|
_displacedObjectLE.preferredWidth = _displacedObjectOriginalSize.x;
|
||||||
_displacedObjectLE.preferredHeight = _displacedObjectOriginalSize.y;
|
_displacedObjectLE.preferredHeight = _displacedObjectOriginalSize.y;
|
||||||
_displacedObject.SetParent(_displacedObjectOriginList.Content, false);
|
_displacedObject.SetParent(_displacedObjectOriginList.Content, false);
|
||||||
if (!_reorderableList.KeepItemRotation)
|
_displacedObject.rotation = _displacedObjectOriginList.transform.rotation;
|
||||||
{
|
|
||||||
_displacedObject.rotation = _displacedObjectOriginList.transform.rotation;
|
|
||||||
}
|
|
||||||
_displacedObject.SetSiblingIndex(_displacedFromIndex);
|
_displacedObject.SetSiblingIndex(_displacedFromIndex);
|
||||||
_displacedObject.gameObject.SetActive(true);
|
_displacedObject.gameObject.SetActive(true);
|
||||||
|
|
||||||
|
@ -388,10 +382,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
RefreshSizes();
|
RefreshSizes();
|
||||||
_draggingObject.SetParent(_currentReorderableListRaycasted.Content, false);
|
_draggingObject.SetParent(_currentReorderableListRaycasted.Content, false);
|
||||||
if (!_reorderableList.KeepItemRotation)
|
_draggingObject.rotation = _currentReorderableListRaycasted.transform.rotation;
|
||||||
{
|
|
||||||
_draggingObject.rotation = _currentReorderableListRaycasted.transform.rotation;
|
|
||||||
}
|
|
||||||
_draggingObject.SetSiblingIndex(_fakeElement.GetSiblingIndex());
|
_draggingObject.SetSiblingIndex(_fakeElement.GetSiblingIndex());
|
||||||
|
|
||||||
//If the item is transferable, it can be dragged out again
|
//If the item is transferable, it can be dragged out again
|
||||||
|
@ -483,10 +474,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
RefreshSizes();
|
RefreshSizes();
|
||||||
_draggingObject.SetParent(_reorderableList.Content, false);
|
_draggingObject.SetParent(_reorderableList.Content, false);
|
||||||
if (!_reorderableList.KeepItemRotation)
|
_draggingObject.rotation = _reorderableList.Content.transform.rotation;
|
||||||
{
|
|
||||||
_draggingObject.rotation = _reorderableList.Content.transform.rotation;
|
|
||||||
}
|
|
||||||
_draggingObject.SetSiblingIndex(_fromIndex);
|
_draggingObject.SetSiblingIndex(_fromIndex);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,6 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#if UNITY_2021_2_OR_NEWER
|
|
||||||
using System.Buffers;
|
|
||||||
#endif
|
|
||||||
#if UNITY_2021_1_OR_NEWER
|
|
||||||
using UnityEngine.Pool;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
|
@ -42,9 +36,6 @@ namespace UnityEngine.UI.Extensions
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
UnityEngine.Gradient _effectGradient = new UnityEngine.Gradient() { colorKeys = new GradientColorKey[] { new GradientColorKey(Color.black, 0), new GradientColorKey(Color.white, 1) } };
|
UnityEngine.Gradient _effectGradient = new UnityEngine.Gradient() { colorKeys = new GradientColorKey[] { new GradientColorKey(Color.black, 0), new GradientColorKey(Color.white, 1) } };
|
||||||
|
|
||||||
private GradientColorKey[] _colorKeys;
|
|
||||||
private GradientAlphaKey[] _alphaKeys;
|
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
public Blend BlendMode
|
public Blend BlendMode
|
||||||
{
|
{
|
||||||
|
@ -112,11 +103,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (!IsActive() || helper.currentVertCount == 0)
|
if (!IsActive() || helper.currentVertCount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if UNITY_2021_1_OR_NEWER
|
|
||||||
List<UIVertex> _vertexList = ListPool<UIVertex>.Get();
|
|
||||||
#else
|
|
||||||
List<UIVertex> _vertexList = new List<UIVertex>();
|
List<UIVertex> _vertexList = new List<UIVertex>();
|
||||||
#endif
|
|
||||||
|
|
||||||
helper.GetUIVertexStream(_vertexList);
|
helper.GetUIVertexStream(_vertexList);
|
||||||
|
|
||||||
|
@ -231,7 +218,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
helper.AddVert(centralVertex);
|
helper.AddVert(centralVertex);
|
||||||
|
|
||||||
for (int i = 1; i < steps; i++) helper.AddTriangle(i, i-1, steps);
|
for (int i = 1; i < steps; i++) helper.AddTriangle(i - 1, i, steps);
|
||||||
helper.AddTriangle(0, steps - 1, steps);
|
helper.AddTriangle(0, steps - 1, steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,10 +238,6 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_2021_1_OR_NEWER
|
|
||||||
ListPool<UIVertex>.Release(_vertexList);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect GetBounds(List<UIVertex> vertices)
|
Rect GetBounds(List<UIVertex> vertices)
|
||||||
|
@ -281,11 +264,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
void SplitTrianglesAtGradientStops(List<UIVertex> _vertexList, Rect bounds, float zoomOffset, VertexHelper helper)
|
void SplitTrianglesAtGradientStops(List<UIVertex> _vertexList, Rect bounds, float zoomOffset, VertexHelper helper)
|
||||||
{
|
{
|
||||||
#if UNITY_2021_1_OR_NEWER
|
List<float> stops = FindStops(zoomOffset, bounds);
|
||||||
List<float> stops = FindStops(zoomOffset, bounds, ListPool<float>.Get());
|
|
||||||
#else
|
|
||||||
List<float> stops = FindStops(zoomOffset, bounds, new List<float>());
|
|
||||||
#endif
|
|
||||||
if (stops.Count > 0)
|
if (stops.Count > 0)
|
||||||
{
|
{
|
||||||
helper.Clear();
|
helper.Clear();
|
||||||
|
@ -293,23 +272,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
int nCount = _vertexList.Count;
|
int nCount = _vertexList.Count;
|
||||||
for (int i = 0; i < nCount; i += 3)
|
for (int i = 0; i < nCount; i += 3)
|
||||||
{
|
{
|
||||||
#if UNITY_2021_2_OR_NEWER
|
float[] positions = GetPositions(_vertexList, i);
|
||||||
var positions = ArrayPool<float>.Shared.Rent(3);
|
|
||||||
#else
|
|
||||||
var positions = new float[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GetPositions(_vertexList, i, ref positions);
|
|
||||||
|
|
||||||
#if UNITY_2021_1_OR_NEWER
|
|
||||||
List<int> originIndices = ListPool<int>.Get();
|
|
||||||
List<UIVertex> starts = ListPool<UIVertex>.Get();
|
|
||||||
List<UIVertex> ends = ListPool<UIVertex>.Get();
|
|
||||||
#else
|
|
||||||
List<int> originIndices = new List<int>(3);
|
List<int> originIndices = new List<int>(3);
|
||||||
List<UIVertex> starts = new List<UIVertex>(3);
|
List<UIVertex> starts = new List<UIVertex>(3);
|
||||||
List<UIVertex> ends = new List<UIVertex>(2);
|
List<UIVertex> ends = new List<UIVertex>(2);
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int s = 0; s < stops.Count; s++)
|
for (int s = 0; s < stops.Count; s++)
|
||||||
{
|
{
|
||||||
|
@ -437,24 +403,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
int vertexCount = helper.currentVertCount;
|
int vertexCount = helper.currentVertCount;
|
||||||
helper.AddTriangle(vertexCount - 3, vertexCount - 2, vertexCount - 1);
|
helper.AddTriangle(vertexCount - 3, vertexCount - 2, vertexCount - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_2021_2_OR_NEWER
|
|
||||||
ArrayPool<float>.Shared.Return(positions);
|
|
||||||
#endif
|
|
||||||
#if UNITY_2021_1_OR_NEWER
|
|
||||||
ListPool<int>.Release(originIndices);
|
|
||||||
ListPool<UIVertex>.Release(starts);
|
|
||||||
ListPool<UIVertex>.Release(ends);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if UNITY_2021_1_OR_NEWER
|
|
||||||
ListPool<float>.Release(stops);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetPositions(List<UIVertex> _vertexList, int index, ref float[] positions)
|
float[] GetPositions(List<UIVertex> _vertexList, int index)
|
||||||
{
|
{
|
||||||
|
float[] positions = new float[3];
|
||||||
if (GradientType == Type.Horizontal)
|
if (GradientType == Type.Horizontal)
|
||||||
{
|
{
|
||||||
positions[0] = _vertexList[index].position.x;
|
positions[0] = _vertexList[index].position.x;
|
||||||
|
@ -467,27 +422,24 @@ namespace UnityEngine.UI.Extensions
|
||||||
positions[1] = _vertexList[index + 1].position.y;
|
positions[1] = _vertexList[index + 1].position.y;
|
||||||
positions[2] = _vertexList[index + 2].position.y;
|
positions[2] = _vertexList[index + 2].position.y;
|
||||||
}
|
}
|
||||||
|
return positions;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<float> FindStops(float zoomOffset, Rect bounds, List<float> stops)
|
List<float> FindStops(float zoomOffset, Rect bounds)
|
||||||
{
|
{
|
||||||
|
List<float> stops = new List<float>();
|
||||||
var offset = Offset * (1 - zoomOffset);
|
var offset = Offset * (1 - zoomOffset);
|
||||||
var startBoundary = zoomOffset - offset;
|
var startBoundary = zoomOffset - offset;
|
||||||
var endBoundary = (1 - zoomOffset) - offset;
|
var endBoundary = (1 - zoomOffset) - offset;
|
||||||
|
|
||||||
if (_colorKeys == null) _colorKeys = EffectGradient.colorKeys;
|
foreach (var color in EffectGradient.colorKeys)
|
||||||
|
|
||||||
foreach (var color in _colorKeys)
|
|
||||||
{
|
{
|
||||||
if (color.time >= endBoundary)
|
if (color.time >= endBoundary)
|
||||||
break;
|
break;
|
||||||
if (color.time > startBoundary)
|
if (color.time > startBoundary)
|
||||||
stops.Add((color.time - startBoundary) * Zoom);
|
stops.Add((color.time - startBoundary) * Zoom);
|
||||||
}
|
}
|
||||||
|
foreach (var alpha in EffectGradient.alphaKeys)
|
||||||
if (_alphaKeys == null) _alphaKeys = _effectGradient.alphaKeys;
|
|
||||||
|
|
||||||
foreach (var alpha in _alphaKeys)
|
|
||||||
{
|
{
|
||||||
if (alpha.time >= endBoundary)
|
if (alpha.time >= endBoundary)
|
||||||
break;
|
break;
|
||||||
|
@ -503,13 +455,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
size = bounds.height;
|
size = bounds.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
stops.Sort((x, y) =>
|
stops.Sort();
|
||||||
{
|
|
||||||
if (x > y) return 1;
|
|
||||||
if (x == y) return 0;
|
|
||||||
return -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (int i = 0; i < stops.Count; i++)
|
for (int i = 0; i < stops.Count; i++)
|
||||||
{
|
{
|
||||||
stops[i] = (stops[i] * size) + min;
|
stops[i] = (stops[i] * size) + min;
|
||||||
|
|
|
@ -499,6 +499,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
m_points = new Vector2[1];
|
m_points = new Vector2[1];
|
||||||
}
|
}
|
||||||
|
if (transform.GetComponent<RectTransform>().position != Vector3.zero)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("A Line Renderer component should be on a RectTransform positioned at (0,0,0), do not use in child Objects.\nFor best results, create separate RectTransforms as children of the canvas positioned at (0,0) for a UILineRenderer and do not move.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,50 +12,32 @@ namespace UnityEngine.UI.Extensions
|
||||||
// The elements between which line segments should be drawn
|
// The elements between which line segments should be drawn
|
||||||
public RectTransform[] transforms;
|
public RectTransform[] transforms;
|
||||||
private Vector3[] previousPositions;
|
private Vector3[] previousPositions;
|
||||||
private Vector3 previousLrPos;
|
private RectTransform canvas;
|
||||||
private Vector3 previousGlobalScale;
|
|
||||||
private RectTransform rt;
|
private RectTransform rt;
|
||||||
private UILineRenderer lr;
|
private UILineRenderer lr;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
var canvasParent = GetComponentInParent<RectTransform>().GetParentCanvas();
|
||||||
|
if (canvasParent != null)
|
||||||
|
{
|
||||||
|
canvas = canvasParent.GetComponent<RectTransform>();
|
||||||
|
}
|
||||||
rt = GetComponent<RectTransform>();
|
rt = GetComponent<RectTransform>();
|
||||||
lr = GetComponent<UILineRenderer>();
|
lr = GetComponent<UILineRenderer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
{
|
{
|
||||||
if (transforms == null || transforms.Length < 1)
|
if (transforms == null || transforms.Length < 1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//Performance check to only redraw when the child transforms move
|
||||||
CalculateLinePoints();
|
if (previousPositions != null && previousPositions.Length == transforms.Length)
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
if (lr.RelativeSize)
|
|
||||||
{
|
|
||||||
Debug.LogWarning("While using UILineConnector, UILineRenderer should not use relative size, so that even if this RectTransform has a zero-size Rect, the positions of the points can still be calculated");
|
|
||||||
lr.RelativeSize = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transforms == null || transforms.Length < 1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get world position of UILineRenderer
|
|
||||||
Vector3 lrWorldPos = rt.position;
|
|
||||||
|
|
||||||
/*Performance check to only redraw when the child transforms move,
|
|
||||||
or the world position of UILineRenderer moves */
|
|
||||||
bool updateLine = lrWorldPos != previousLrPos;
|
|
||||||
updateLine = rt.lossyScale != previousGlobalScale;
|
|
||||||
|
|
||||||
if (!updateLine && previousPositions != null && previousPositions.Length == transforms.Length)
|
|
||||||
{
|
{
|
||||||
|
bool updateLine = false;
|
||||||
for (int i = 0; i < transforms.Length; i++)
|
for (int i = 0; i < transforms.Length; i++)
|
||||||
{
|
{
|
||||||
if (transforms[i] == null)
|
if (transforms[i] == null)
|
||||||
|
@ -65,20 +47,47 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (!updateLine && previousPositions[i] != transforms[i].position)
|
if (!updateLine && previousPositions[i] != transforms[i].position)
|
||||||
{
|
{
|
||||||
updateLine = true;
|
updateLine = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!updateLine) return;
|
||||||
if (!updateLine) return;
|
}
|
||||||
|
|
||||||
|
// Get the pivot points
|
||||||
|
Vector2 thisPivot = rt.pivot;
|
||||||
|
Vector2 canvasPivot = canvas.pivot;
|
||||||
|
|
||||||
// Calculate delta from the local position
|
// Set up some arrays of coordinates in various reference systems
|
||||||
CalculateLinePoints();
|
Vector3[] worldSpaces = new Vector3[transforms.Length];
|
||||||
|
Vector3[] canvasSpaces = new Vector3[transforms.Length];
|
||||||
|
Vector2[] points = new Vector2[transforms.Length];
|
||||||
|
|
||||||
|
// First, convert the pivot to worldspace
|
||||||
|
for (int i = 0; i < transforms.Length; i++)
|
||||||
|
{
|
||||||
|
if (transforms[i] == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
worldSpaces[i] = transforms[i].TransformPoint(thisPivot);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then, convert to canvas space
|
||||||
|
for (int i = 0; i < transforms.Length; i++)
|
||||||
|
{
|
||||||
|
canvasSpaces[i] = canvas.InverseTransformPoint(worldSpaces[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate delta from the canvas pivot point
|
||||||
|
for (int i = 0; i < transforms.Length; i++)
|
||||||
|
{
|
||||||
|
points[i] = new Vector2(canvasSpaces[i].x, canvasSpaces[i].y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// And assign the converted points to the line renderer
|
||||||
|
lr.Points = points;
|
||||||
|
lr.RelativeSize = false;
|
||||||
|
lr.drivenExternally = true;
|
||||||
|
|
||||||
//save previous states
|
|
||||||
previousLrPos = lrWorldPos;
|
|
||||||
previousGlobalScale = rt.lossyScale;
|
|
||||||
previousPositions = new Vector3[transforms.Length];
|
previousPositions = new Vector3[transforms.Length];
|
||||||
for (int i = 0; i < transforms.Length; i++)
|
for (int i = 0; i < transforms.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -89,24 +98,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
previousPositions[i] = transforms[i].position;
|
previousPositions[i] = transforms[i].position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateLinePoints()
|
|
||||||
{
|
|
||||||
Vector2[] points = new Vector2[transforms.Length];
|
|
||||||
for (int i = 0; i < transforms.Length; i++)
|
|
||||||
{
|
|
||||||
if (transforms[i] == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
var offsetPos = rt.InverseTransformPoint(transforms[i].position);
|
|
||||||
points[i] = new Vector2(offsetPos.x, offsetPos.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// And assign the converted points to the line renderer
|
|
||||||
lr.Points = points;
|
|
||||||
lr.RelativeSize = false;
|
|
||||||
lr.drivenExternally = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "com.unity.uiextensions",
|
"name": "com.unity.uiextensions",
|
||||||
"displayName": "Unity UI Extensions",
|
"displayName": "Unity UI Extensions",
|
||||||
"version": "2.3.3-pre.1",
|
"version": "2.3.2",
|
||||||
"description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community",
|
"description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community",
|
||||||
"author": "Simon darkside Jackson <@SimonDarksideJ>",
|
"author": "Simon darkside Jackson <@SimonDarksideJ>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
|
|
Loading…
Reference in New Issue