You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-16 13:10:07 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0322d7eb95 | ||
|
|
e7be0e77de | ||
|
|
3880484ce5 | ||
|
|
1d40e24c74 | ||
|
|
54a4b1cdfd | ||
|
|
5505247a94 | ||
|
|
f26920f982 | ||
|
|
5a1e65ec56 | ||
|
|
accd3f8410 | ||
|
|
05286cedfd | ||
|
|
cbd9c960e2 | ||
|
|
e924eb4596 | ||
|
|
19989cf18c | ||
|
|
30b00762f6 | ||
|
|
154a04c022 | ||
|
|
3eab0979b9 |
53
.github/workflows/release.yml
vendored
53
.github/workflows/release.yml
vendored
@@ -4,8 +4,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- preview
|
|
||||||
- release
|
- release
|
||||||
|
- release-preview
|
||||||
|
- release-v4
|
||||||
tags-ignore:
|
tags-ignore:
|
||||||
- "**"
|
- "**"
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@ jobs:
|
|||||||
released: ${{ steps.release.outputs.new_release_published }}
|
released: ${{ steps.release.outputs.new_release_published }}
|
||||||
tag: ${{ steps.release.outputs.new_release_git_tag }}
|
tag: ${{ steps.release.outputs.new_release_git_tag }}
|
||||||
version: ${{ steps.release.outputs.new_release_version }}
|
version: ${{ steps.release.outputs.new_release_version }}
|
||||||
notes: ${{ steps.release.outputs.new_release_notes }}
|
merge_to: ${{ steps.summary.outputs.merge_to }}
|
||||||
|
split_to: ${{ steps.summary.outputs.split_to }}
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Checkout (${{ github.ref_name }})
|
- name: 🚚 Checkout (${{ github.ref_name }})
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -38,37 +40,51 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
- run: |
|
- id: summary
|
||||||
|
run: |
|
||||||
echo "🔖 New release published: '${{ steps.release.outputs.new_release_published }}'" | tee -a $GITHUB_STEP_SUMMARY
|
echo "🔖 New release published: '${{ steps.release.outputs.new_release_published }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
echo "🔖 New release version: '${{ steps.release.outputs.new_release_version }}'" | tee -a $GITHUB_STEP_SUMMARY
|
echo "🔖 New release version: '${{ steps.release.outputs.new_release_version }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
echo "🔖 New release channel: '${{ steps.release.outputs.new_release_channel }}'" | tee -a $GITHUB_STEP_SUMMARY
|
echo "🔖 New release channel: '${{ steps.release.outputs.new_release_channel }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
echo "🔖 New release git tag: '${{ steps.release.outputs.new_release_git_tag }}'" | tee -a $GITHUB_STEP_SUMMARY
|
echo "🔖 New release git tag: '${{ steps.release.outputs.new_release_git_tag }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
merge-to-develop:
|
if [ '${{ steps.release.outputs.new_release_published }}' = 'false' ]; then
|
||||||
if: needs.release.outputs.released == 'true'
|
echo "No new release published." | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
elif [ '${{ github.ref_name }}' = 'release' ]; then
|
||||||
|
echo "merge_to=develop" | tee -a $GITHUB_OUTPUT
|
||||||
|
echo "split_to=main" | tee -a $GITHUB_OUTPUT
|
||||||
|
elif [ '${{ github.ref_name }}' = 'release-preview' ]; then
|
||||||
|
echo "merge_to=develop-preview" | tee -a $GITHUB_OUTPUT
|
||||||
|
echo "split_to=preview" | tee -a $GITHUB_OUTPUT
|
||||||
|
elif [ '${{ github.ref_name }}' = 'release-4.x' ]; then
|
||||||
|
echo "merge_to=develop-4.x" | tee -a $GITHUB_OUTPUT
|
||||||
|
echo "split_to=4.x" | tee -a $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
merge-to:
|
||||||
|
if: needs.release.outputs.merge_to != ''
|
||||||
needs: release
|
needs: release
|
||||||
name: 🔀 Merge to develop
|
name: 🔀 Merge to ${{ needs.release.outputs.merge_to }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Checkout (develop)
|
- name: 🚚 Checkout (${{ needs.release.outputs.merge_to }})
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: develop
|
ref: ${{ needs.release.outputs.merge_to }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: 🔀 Merge '${{ needs.release.outputs.tag }}' into 'develop'
|
- name: 🔀 Merge '${{ needs.release.outputs.tag }}' into '${{ needs.release.outputs.merge_to }}'
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
|
|
||||||
git merge ${{ needs.release.outputs.tag }}
|
git merge ${{ needs.release.outputs.tag }}
|
||||||
git push origin develop
|
git push origin ${{ needs.release.outputs.merge_to }}
|
||||||
|
|
||||||
split-to-main:
|
split-to:
|
||||||
if: needs.release.outputs.released == 'true'
|
if: needs.release.outputs.split_to != ''
|
||||||
needs: release
|
needs: release
|
||||||
name: 🔀 Split package
|
name: 🔀 Split package to ${{ needs.release.outputs.split_to }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -78,9 +94,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: ${{ needs.release.outputs.tag }}
|
ref: ${{ needs.release.outputs.tag }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: 🔀 Split subtree 'Packages/src' to 'main'
|
- name: 🔀 Split subtree 'Packages/src' to '${{ needs.release.outputs.split_to }}'
|
||||||
run: |
|
run: |
|
||||||
git branch main origin/main
|
split_to=${{ needs.release.outputs.split_to }}
|
||||||
git subtree split --prefix=Packages/src --branch main
|
git branch $split_to origin/$split_to
|
||||||
git tag ${{ needs.release.outputs.version }} main
|
git subtree split --prefix=Packages/src --branch $split_to
|
||||||
git push origin ${{ needs.release.outputs.version }} main:main
|
git tag ${{ needs.release.outputs.version }} $split_to
|
||||||
|
git push origin ${{ needs.release.outputs.version }} $split_to:$split_to
|
||||||
|
|||||||
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -15,6 +15,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- develop
|
- develop
|
||||||
|
- develop-preview
|
||||||
|
- develop-4.x
|
||||||
tags:
|
tags:
|
||||||
- "!*"
|
- "!*"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@@ -56,6 +58,7 @@ jobs:
|
|||||||
needs: setup
|
needs: setup
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -28,3 +28,4 @@ Assets/Plugins/
|
|||||||
obj/
|
obj/
|
||||||
bin/
|
bin/
|
||||||
UserSettings/
|
UserSettings/
|
||||||
|
*.app
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"branches": [
|
"branches": [
|
||||||
"release",
|
"release",
|
||||||
|
"release-4.x",
|
||||||
{
|
{
|
||||||
"name": "preview",
|
"name": "release-preview",
|
||||||
"prerelease": true
|
"prerelease": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,3 +1,46 @@
|
|||||||
|
# [4.7.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.8...v4.7.0) (2024-06-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* `UIParticle.transform.localScale` does not scale particles ([1d40e24](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/1d40e24c742741e97f03c55468ccb1e505341133)), closes [#313](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/313)
|
||||||
|
* UIParticle is scaled by canvas size even when `AutoScalingMode.None` and `ScalingMode.Local` ([54a4b1c](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/54a4b1cdfd06400c7be89c1ee704bb42a659c7c2)), closes [#313](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/313)
|
||||||
|
* UIParticle is scaled incorrectly with nested canvases ([f26920f](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/f26920f9825547222a4afbb31cc5dc5a002c3e9b)), closes [#313](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/313)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* reset previous position on start play for world space simulation ([3880484](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3880484ce5190c42fc79c81d0b69e3fbeda09dd0)), closes [#303](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/303)
|
||||||
|
* restore `Transform.localScale` when setting `autoScalingMode` to something other than `Transform` ([5505247](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/5505247a94a929ff89635fde512a9b95691e0043))
|
||||||
|
|
||||||
|
## [4.6.8](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.7...v4.6.8) (2024-06-14)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* 'Resource ID out of range in GetResource' error in overlay rendering mode ([05286ce](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/05286cedfd17b1a0cb90a5e918513644f47cd831)), closes [#308](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/308)
|
||||||
|
|
||||||
|
## [4.6.7](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.6...v4.6.7) (2024-05-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* the ParticleSystem's localPosition drifts at certain scales due to floating-point precision issues ([e924eb4](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e924eb45968a112347471cabaeabc274e4c37ce4)), closes [#299](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/299) [#312](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/312)
|
||||||
|
|
||||||
|
## [4.6.6](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.5...v4.6.6) (2024-05-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix release workflow ([30b0076](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/30b00762f6da166c043587798b1552f27b4cc604))
|
||||||
|
|
||||||
|
## [4.6.5](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.4...v4.6.5) (2024-05-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update workflows (for preview and v4) ([3eab097](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3eab0979b9b85919b804442ab05735b7120eade5))
|
||||||
|
|
||||||
## [4.6.4](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.3...v4.6.4) (2024-05-22)
|
## [4.6.4](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.3...v4.6.4) (2024-05-22)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -475,20 +475,7 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
private static void DrawAutoScaling(SerializedProperty prop, IEnumerable<UIParticle> uiParticles)
|
private static void DrawAutoScaling(SerializedProperty prop, IEnumerable<UIParticle> uiParticles)
|
||||||
{
|
{
|
||||||
var isTransformMode = prop.intValue == (int)UIParticle.AutoScalingMode.Transform;
|
|
||||||
EditorGUI.BeginChangeCheck();
|
|
||||||
EditorGUILayout.PropertyField(prop);
|
EditorGUILayout.PropertyField(prop);
|
||||||
if (!EditorGUI.EndChangeCheck() || !isTransformMode) return;
|
|
||||||
|
|
||||||
// on changed true->false, reset scale.
|
|
||||||
EditorApplication.delayCall += () =>
|
|
||||||
{
|
|
||||||
foreach (var uip in uiParticles)
|
|
||||||
{
|
|
||||||
if (!uip) continue;
|
|
||||||
uip.transform.localScale = Vector3.one;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_2021_2_OR_NEWER
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Coffee.UIParticleExtensions;
|
using Coffee.UIParticleExtensions;
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
@@ -104,6 +103,8 @@ namespace Coffee.UIExtensions
|
|||||||
private int _groupId;
|
private int _groupId;
|
||||||
private Camera _orthoCamera;
|
private Camera _orthoCamera;
|
||||||
private DrivenRectTransformTracker _tracker;
|
private DrivenRectTransformTracker _tracker;
|
||||||
|
private Vector3 _storedScale;
|
||||||
|
private bool _isScaleStored;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should this graphic be considered a target for ray-casting?
|
/// Should this graphic be considered a target for ray-casting?
|
||||||
@@ -201,7 +202,12 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
if (m_AutoScalingMode == value) return;
|
if (m_AutoScalingMode == value) return;
|
||||||
m_AutoScalingMode = value;
|
m_AutoScalingMode = value;
|
||||||
UpdateTracker();
|
|
||||||
|
if (autoScalingMode != AutoScalingMode.Transform && _isScaleStored)
|
||||||
|
{
|
||||||
|
transform.localScale = _storedScale;
|
||||||
|
_isScaleStored = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,9 +250,9 @@ namespace Coffee.UIExtensions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Particle effect scale.
|
/// Particle effect scale.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector3 scale3DForCalc => autoScalingMode == AutoScalingMode.UIParticle
|
public Vector3 scale3DForCalc => autoScalingMode == AutoScalingMode.Transform
|
||||||
? m_Scale3D.GetScaled(canvasScale)
|
? m_Scale3D
|
||||||
: m_Scale3D;
|
: m_Scale3D.GetScaled(canvasScale, transform.localScale);
|
||||||
|
|
||||||
public List<ParticleSystem> particles => m_Particles;
|
public List<ParticleSystem> particles => m_Particles;
|
||||||
|
|
||||||
@@ -279,8 +285,8 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
protected override void OnEnable()
|
protected override void OnEnable()
|
||||||
{
|
{
|
||||||
|
_isScaleStored = false;
|
||||||
ResetGroupId();
|
ResetGroupId();
|
||||||
UpdateTracker();
|
|
||||||
UIParticleUpdater.Register(this);
|
UIParticleUpdater.Register(this);
|
||||||
RegisterDirtyMaterialCallback(UpdateRendererMaterial);
|
RegisterDirtyMaterialCallback(UpdateRendererMaterial);
|
||||||
|
|
||||||
@@ -301,7 +307,13 @@ namespace Coffee.UIExtensions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void OnDisable()
|
protected override void OnDisable()
|
||||||
{
|
{
|
||||||
UpdateTracker();
|
_tracker.Clear();
|
||||||
|
if (autoScalingMode == AutoScalingMode.Transform && _isScaleStored)
|
||||||
|
{
|
||||||
|
transform.localScale = _storedScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isScaleStored = false;
|
||||||
UIParticleUpdater.Unregister(this);
|
UIParticleUpdater.Unregister(this);
|
||||||
_renderers.ForEach(r => r.Reset());
|
_renderers.ForEach(r => r.Reset());
|
||||||
UnregisterDirtyMaterialCallback(UpdateRendererMaterial);
|
UnregisterDirtyMaterialCallback(UpdateRendererMaterial);
|
||||||
@@ -316,14 +328,6 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
protected override void OnValidate()
|
|
||||||
{
|
|
||||||
base.OnValidate();
|
|
||||||
UpdateTracker();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -482,12 +486,26 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
internal void UpdateTransformScale()
|
internal void UpdateTransformScale()
|
||||||
{
|
{
|
||||||
|
_tracker.Clear();
|
||||||
canvasScale = canvas.rootCanvas.transform.localScale.Inverse();
|
canvasScale = canvas.rootCanvas.transform.localScale.Inverse();
|
||||||
parentScale = transform.parent.lossyScale;
|
parentScale = transform.parent.lossyScale;
|
||||||
if (autoScalingMode != AutoScalingMode.Transform) return;
|
if (autoScalingMode != AutoScalingMode.Transform)
|
||||||
|
{
|
||||||
|
if (_isScaleStored)
|
||||||
|
{
|
||||||
|
transform.localScale = _storedScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isScaleStored = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentScale = transform.localScale;
|
||||||
|
_storedScale = currentScale;
|
||||||
|
_isScaleStored = true;
|
||||||
|
_tracker.Add(this, rectTransform, DrivenTransformProperties.Scale);
|
||||||
var newScale = parentScale.Inverse();
|
var newScale = parentScale.Inverse();
|
||||||
if (transform.localScale != newScale)
|
if (currentScale != newScale)
|
||||||
{
|
{
|
||||||
transform.localScale = newScale;
|
transform.localScale = newScale;
|
||||||
}
|
}
|
||||||
@@ -605,22 +623,14 @@ namespace Coffee.UIExtensions
|
|||||||
_orthoCamera.transform.SetPositionAndRotation(new Vector3(0, 0, -1000), Quaternion.identity);
|
_orthoCamera.transform.SetPositionAndRotation(new Vector3(0, 0, -1000), Quaternion.identity);
|
||||||
_orthoCamera.orthographic = true;
|
_orthoCamera.orthographic = true;
|
||||||
_orthoCamera.farClipPlane = 2000f;
|
_orthoCamera.farClipPlane = 2000f;
|
||||||
|
_orthoCamera.clearFlags = CameraClearFlags.Nothing;
|
||||||
|
_orthoCamera.cullingMask = 0; // Nothing
|
||||||
|
_orthoCamera.allowHDR = false;
|
||||||
|
_orthoCamera.allowMSAA = false;
|
||||||
|
_orthoCamera.renderingPath = RenderingPath.Forward;
|
||||||
|
_orthoCamera.useOcclusionCulling = false;
|
||||||
|
|
||||||
return _orthoCamera;
|
return _orthoCamera;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateTracker()
|
|
||||||
{
|
|
||||||
#pragma warning disable CS0618 // Type or member is obsolete
|
|
||||||
if (!enabled || !autoScaling || autoScalingMode != AutoScalingMode.Transform)
|
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
|
||||||
{
|
|
||||||
_tracker.Clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_tracker.Add(this, rectTransform, DrivenTransformProperties.Scale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace Coffee.UIExtensions
|
|||||||
private float _prevCanvasScale;
|
private float _prevCanvasScale;
|
||||||
private Vector3 _prevPsPos;
|
private Vector3 _prevPsPos;
|
||||||
private Vector3 _prevScale;
|
private Vector3 _prevScale;
|
||||||
|
private bool _isPrevStored;
|
||||||
private Vector2Int _prevScreenSize;
|
private Vector2Int _prevScreenSize;
|
||||||
private bool _prewarm;
|
private bool _prewarm;
|
||||||
private ParticleSystemRenderer _renderer;
|
private ParticleSystemRenderer _renderer;
|
||||||
@@ -146,6 +147,7 @@ namespace Coffee.UIExtensions
|
|||||||
ModifiedMaterial.Remove(_modifiedMaterial);
|
ModifiedMaterial.Remove(_modifiedMaterial);
|
||||||
_modifiedMaterial = null;
|
_modifiedMaterial = null;
|
||||||
_currentMaterialForRendering = null;
|
_currentMaterialForRendering = null;
|
||||||
|
_isPrevStored = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UIParticleRenderer AddRenderer(UIParticle parent, int index)
|
public static UIParticleRenderer AddRenderer(UIParticle parent, int index)
|
||||||
@@ -524,7 +526,7 @@ namespace Coffee.UIExtensions
|
|||||||
&& _particleSystem.main.scalingMode == ParticleSystemScalingMode.Local
|
&& _particleSystem.main.scalingMode == ParticleSystemScalingMode.Local
|
||||||
&& _parent.canvas)
|
&& _parent.canvas)
|
||||||
{
|
{
|
||||||
scale = scale.GetScaled(_parent.canvas.transform.localScale);
|
scale = scale.GetScaled(_parent.canvas.rootCanvas.transform.localScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
Profiler.EndSample();
|
Profiler.EndSample();
|
||||||
@@ -581,7 +583,7 @@ namespace Coffee.UIExtensions
|
|||||||
var isWorldSpace = _particleSystem.IsWorldSpace();
|
var isWorldSpace = _particleSystem.IsWorldSpace();
|
||||||
var canvasScale = _parent.canvas ? _parent.canvas.scaleFactor : 1f;
|
var canvasScale = _parent.canvas ? _parent.canvas.scaleFactor : 1f;
|
||||||
var resolutionChanged = _prevScreenSize != screenSize || _prevCanvasScale != canvasScale;
|
var resolutionChanged = _prevScreenSize != screenSize || _prevCanvasScale != canvasScale;
|
||||||
if (resolutionChanged && isWorldSpace)
|
if (resolutionChanged && isWorldSpace && _isPrevStored)
|
||||||
{
|
{
|
||||||
// Update particle array size and get particles.
|
// Update particle array size and get particles.
|
||||||
var size = _particleSystem.particleCount;
|
var size = _particleSystem.particleCount;
|
||||||
@@ -607,6 +609,7 @@ namespace Coffee.UIExtensions
|
|||||||
_delay = true;
|
_delay = true;
|
||||||
_prevScale = scale;
|
_prevScale = scale;
|
||||||
_prevPsPos = psPos;
|
_prevPsPos = psPos;
|
||||||
|
_isPrevStored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_prevCanvasScale = canvas ? canvas.scaleFactor : 1f;
|
_prevCanvasScale = canvas ? canvas.scaleFactor : 1f;
|
||||||
@@ -632,13 +635,15 @@ namespace Coffee.UIExtensions
|
|||||||
// get world position.
|
// get world position.
|
||||||
var isLocalSpace = _particleSystem.IsLocalSpace();
|
var isLocalSpace = _particleSystem.IsLocalSpace();
|
||||||
var psTransform = _particleSystem.transform;
|
var psTransform = _particleSystem.transform;
|
||||||
|
var originLocalPosition = psTransform.localPosition;
|
||||||
|
var originLocalRotation = psTransform.localRotation;
|
||||||
var originWorldPosition = psTransform.position;
|
var originWorldPosition = psTransform.position;
|
||||||
var originWorldRotation = psTransform.rotation;
|
var originWorldRotation = psTransform.rotation;
|
||||||
var emission = _particleSystem.emission;
|
var emission = _particleSystem.emission;
|
||||||
var rateOverDistance = emission.enabled
|
var rateOverDistance = emission.enabled
|
||||||
&& 0 < emission.rateOverDistance.constant
|
&& 0 < emission.rateOverDistance.constant
|
||||||
&& 0 < emission.rateOverDistanceMultiplier;
|
&& 0 < emission.rateOverDistanceMultiplier;
|
||||||
if (rateOverDistance && !paused)
|
if (rateOverDistance && !paused && _isPrevStored)
|
||||||
{
|
{
|
||||||
// (For rate-over-distance emission,) Move to previous scaled position, simulate (delta = 0).
|
// (For rate-over-distance emission,) Move to previous scaled position, simulate (delta = 0).
|
||||||
var prevScaledPos = isLocalSpace
|
var prevScaledPos = isLocalSpace
|
||||||
@@ -654,7 +659,8 @@ namespace Coffee.UIExtensions
|
|||||||
: originWorldPosition.GetScaled(scale.Inverse());
|
: originWorldPosition.GetScaled(scale.Inverse());
|
||||||
psTransform.SetPositionAndRotation(scaledPos, originWorldRotation);
|
psTransform.SetPositionAndRotation(scaledPos, originWorldRotation);
|
||||||
_particleSystem.Simulate(deltaTime, false, false, false);
|
_particleSystem.Simulate(deltaTime, false, false, false);
|
||||||
psTransform.SetPositionAndRotation(originWorldPosition, originWorldRotation);
|
psTransform.localPosition = originLocalPosition;
|
||||||
|
psTransform.localRotation = originLocalRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
|||||||
@@ -57,9 +57,8 @@ namespace Coffee.UIExtensions
|
|||||||
for (var i = 0; i < s_ActiveParticles.Count; i++)
|
for (var i = 0; i < s_ActiveParticles.Count; i++)
|
||||||
{
|
{
|
||||||
var uip = s_ActiveParticles[i];
|
var uip = s_ActiveParticles[i];
|
||||||
if (!uip || !uip.canvas || !uip.isPrimary || s_UpdatedGroupIds.Contains(uip.groupId)) continue;
|
if (!uip || !uip.canvas || !uip.isPrimary || !s_UpdatedGroupIds.Add(uip.groupId)) continue;
|
||||||
|
|
||||||
s_UpdatedGroupIds.Add(uip.groupId);
|
|
||||||
uip.UpdateTransformScale();
|
uip.UpdateTransformScale();
|
||||||
uip.UpdateRenderers();
|
uip.UpdateRenderers();
|
||||||
}
|
}
|
||||||
@@ -76,9 +75,8 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
uip.UpdateRenderers();
|
uip.UpdateRenderers();
|
||||||
}
|
}
|
||||||
else if (!s_UpdatedGroupIds.Contains(uip.groupId))
|
else if (s_UpdatedGroupIds.Add(uip.groupId))
|
||||||
{
|
{
|
||||||
s_UpdatedGroupIds.Add(uip.groupId);
|
|
||||||
uip.UpdateRenderers();
|
uip.UpdateRenderers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14461,7 +14461,7 @@ Canvas:
|
|||||||
m_GameObject: {fileID: 1074082869}
|
m_GameObject: {fileID: 1074082869}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_RenderMode: 0
|
m_RenderMode: 1
|
||||||
m_Camera: {fileID: 1023393581}
|
m_Camera: {fileID: 1023393581}
|
||||||
m_PlaneDistance: 100
|
m_PlaneDistance: 100
|
||||||
m_PixelPerfect: 0
|
m_PixelPerfect: 0
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.coffee.ui-particle",
|
"name": "com.coffee.ui-particle",
|
||||||
"displayName": "UI Particle",
|
"displayName": "UI Particle",
|
||||||
"description": "This package provides a component to render particle effects for uGUI.\nThe particle rendering is maskable and sortable, without the need for an extra Camera, RenderTexture, or Canvas.",
|
"description": "This package provides a component to render particle effects for uGUI.\nThe particle rendering is maskable and sortable, without the need for an extra Camera, RenderTexture, or Canvas.",
|
||||||
"version": "4.6.4",
|
"version": "4.7.0",
|
||||||
"unity": "2018.2",
|
"unity": "2018.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user