Compare commits

...

7 Commits

Author SHA1 Message Date
mob-sakai 3f2f12d2cf fix: autoScaling and PositionMode may be locked 2023-08-18 21:22:35 +09:00
semantic-release-bot b9643b98ff chore(release): 4.2.0 [skip ci]
# [4.2.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.1.7...4.2.0) (2023-08-18)

### Bug Fixes

* assertion 'ps->array_size()' in UpdateMesh() when using trails of type ribbon ([f75fcce](f75fcce0da)), closes [#241](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/241)
* built-in shaders are no longer supported ([c2119c1](c2119c171a)), closes [#233](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/233) [#257](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/257)
* crash occurs when too many vertices are rendered ([723a04d](723a04d0cf))
* error: SerializedObject target has been destroyed ([e930516](e93051603e)), closes [#267](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/267)
* excessive particle emitted on move ParticleSystem for local space simulation and emission over distance ([2fe0bde](2fe0bde422)), closes [#265](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/265)
* fix typos ([52f2ef1](52f2ef1f24))
* generated GameObject will be named '[generated] *' ([9b2e5c1](9b2e5c1d10))
* inactive ParticleSystems are removed from the list on refresh ([4851a18](4851a1880e))
* mesh sharing not working ([8b4ca1a](8b4ca1add5)), closes [#236](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/236)
* nullptr exceptions when using nested UIParticle components in hierarchy ([e67e948](e67e9482e2)), closes [#246](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/246)
* nullReferenceException after copy-n-paste ([425aad0](425aad0cba)), closes [#258](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/258)
* remove unnecessary per-frame allocation. ([e92b514](e92b514624))
* scaling ParticleSystem puts prewarmed particles in wrong location ([fb31db4](fb31db47f2)), closes [#235](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/235)
* sub-emitters option is not work in editor playing ([b308b26](b308b26833)), closes [#231](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/231)
* the camera under UIParticle will be assigned as _orthoCamera ([c42f8c8](c42f8c8ab0))
* UIParticleAttractor attracts the particles at wrong position when in RelativeMode ([68d9925](68d9925a16)), closes [#262](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/262)

### Features

* 'AbsoluteMode' option is renamed to 'PositionMode' ([67eff61](67eff61073))
* 'AutoScaling' option will be imported from 'IgnoreCanvasScale' (for v3.x) ([4103041](410304125f))
* add 'AutoScaling' option for UIParticle ([35325c8](35325c8899))
* add 'UpdateMode' option for UIParticleAttractor ([903f702](903f702d7b)), closes [#250](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/250)
* add particle system getter and setter for attractor ([a4bcf93](a4bcf93022)), closes [#253](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/253)
* add public properties for UIParticleAttractor ([392ab6d](392ab6dd76)), closes [#253](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/253)
* add Start/StopEmission API for UIParticle ([e499836](e4998365c9)), closes [#240](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/240)
2023-08-18 08:54:23 +00:00
mob-sakai b36a1571b3 chore: fix workflows 2023-08-18 17:52:48 +09:00
mob-sakai c42f8c8ab0 fix: the camera under UIParticle will be assigned as _orthoCamera
Prevents unintended camera control
2023-08-18 17:45:04 +09:00
mob-sakai 9b2e5c1d10 fix: generated GameObject will be named '[generated] *'
These objects are automatically generated and are not stored in the scene or prefab (HideFlags.DontSave)
2023-08-18 17:45:04 +09:00
mob-sakai 821f08ff5c docs: add FAQ 2023-08-18 17:45:04 +09:00
mob-sakai 28d8698597 fix compile error on Unity 2021.1 2023-08-18 17:45:04 +09:00
8 changed files with 83 additions and 30 deletions

View File

@ -13,9 +13,9 @@ jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: cycjimmy/semantic-release-action@v2 - uses: cycjimmy/semantic-release-action@v3
with: with:
extra_plugins: | extra_plugins: |
@semantic-release/changelog @semantic-release/changelog

View File

@ -36,7 +36,7 @@ jobs:
steps: steps:
# Checkout sandbox project # Checkout sandbox project
- uses: actions/checkout@v2 - uses: actions/checkout@v3
with: with:
ref: sandbox ref: sandbox
submodules: true submodules: true
@ -48,7 +48,7 @@ jobs:
run: git checkout ${{ github.sha }} run: git checkout ${{ github.sha }}
# Cache # Cache
- uses: actions/cache@v2 - uses: actions/cache@v3
with: with:
path: Library path: Library
key: Library-${{ matrix.version }}-${{ github.sha }} key: Library-${{ matrix.version }}-${{ github.sha }}

View File

@ -1,3 +1,36 @@
# [4.2.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.1.7...4.2.0) (2023-08-18)
### Bug Fixes
* assertion 'ps->array_size()' in UpdateMesh() when using trails of type ribbon ([f75fcce](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/f75fcce0dae0bc166bd01d36a150aded1fd721f3)), closes [#241](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/241)
* built-in shaders are no longer supported ([c2119c1](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/c2119c171a1262431eac7fea6bf3125db2bcaaca)), closes [#233](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/233) [#257](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/257)
* crash occurs when too many vertices are rendered ([723a04d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/723a04d0cfd156715a3c92b6d6bd75fdc1862c28))
* error: SerializedObject target has been destroyed ([e930516](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e93051603e121732c92bcd89ded48087c2b0d7fb)), closes [#267](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/267)
* excessive particle emitted on move ParticleSystem for local space simulation and emission over distance ([2fe0bde](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/2fe0bde422f9769dfedaf6b053ea07f773646679)), closes [#265](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/265)
* fix typos ([52f2ef1](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/52f2ef1f2471a2e1c29fca96255c04b222d9c848))
* generated GameObject will be named '[generated] *' ([9b2e5c1](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/9b2e5c1d1024e091de6d18a4578cd18b43563e48))
* inactive ParticleSystems are removed from the list on refresh ([4851a18](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/4851a1880eef9f385dd9db644ea7e544f95da4fc))
* mesh sharing not working ([8b4ca1a](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/8b4ca1add5c409601e840253e1c0dbcdbf536da8)), closes [#236](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/236)
* nullptr exceptions when using nested UIParticle components in hierarchy ([e67e948](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e67e9482e2cb840b16e2cfe76e04f7423fcbd3a3)), closes [#246](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/246)
* nullReferenceException after copy-n-paste ([425aad0](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/425aad0cbab475635c72bee84ecbf3f2acedccc2)), closes [#258](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/258)
* remove unnecessary per-frame allocation. ([e92b514](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e92b514624cc362e53ddeae5ade20fa732f94c7c))
* scaling ParticleSystem puts prewarmed particles in wrong location ([fb31db4](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/fb31db47f2debb3aadbdc4d1b88d0efd9c4ad7bd)), closes [#235](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/235)
* sub-emitters option is not work in editor playing ([b308b26](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/b308b2683372662bb834b6f6d23ea3435a68d1b3)), closes [#231](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/231)
* the camera under UIParticle will be assigned as _orthoCamera ([c42f8c8](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/c42f8c8ab0ff033689349a81e02a4808e071a8a2))
* UIParticleAttractor attracts the particles at wrong position when in RelativeMode ([68d9925](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/68d9925a16237df3c7b07b4781172cbd03425421)), closes [#262](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/262)
### Features
* 'AbsoluteMode' option is renamed to 'PositionMode' ([67eff61](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/67eff610736344ba0122163ff5ee63b25c43f555))
* 'AutoScaling' option will be imported from 'IgnoreCanvasScale' (for v3.x) ([4103041](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/410304125f3f25f3f543c7bc01dcc661eab00609))
* add 'AutoScaling' option for UIParticle ([35325c8](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/35325c88996fa6aea19a6dd1395c05884e1f84ae))
* add 'UpdateMode' option for UIParticleAttractor ([903f702](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/903f702d7be38228841a5a693e3afdceb4a59d9f)), closes [#250](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/250)
* add particle system getter and setter for attractor ([a4bcf93](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/a4bcf93022d2729f3d2a74a2cac4f52e68641b18)), closes [#253](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/253)
* add public properties for UIParticleAttractor ([392ab6d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/392ab6dd76c36e815320d3a50744d19faa631260)), closes [#253](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/253)
* add Start/StopEmission API for UIParticle ([e499836](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e4998365c9825fa385e0a317768ce073a1f15b48)), closes [#240](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/240)
## [4.1.7](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.1.6...4.1.7) (2022-08-30) ## [4.1.7](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.1.6...4.1.7) (2022-08-30)

View File

@ -246,6 +246,32 @@ uiParticle.Stop();
## Development Note ## Development Note
### FAQ: Why are my particle effects not displayed correctly?
If `ParticleSystem` alone displays particles correctly but `UIParticle` does not, please check the following points:
* [Shader Limitation](https://github.com/mob-sakai/ParticleEffectForUGUI#shader-limitation)
* Most cases can be solved by using `UI/Additive` or `UI/Default`.
* Particles are masked
* `UIParticle` is maskable.
* Set `Mask` or `RectMask2D` component properly.
* Particles are too small
* If particles are small enough, they will not appear on the screen.
* Increase the `Scale` value.
* If you don't want to change the apparent size depending on the resolution, try `Auto Scaling` option.
* Particles are too many
* No more than 65535 vertices can be displayed (for mesh combination limitations).
* Please set `Emission` module and `Max Particles` of ParticleSystem properly.
* Particles are emitted off-screen.
* When `Position Mode = Relative`, particles are emitted from scaled position of the ParticleSystem, not from the screen point of the ParticleSystem.
* Place the ParticleSystem in the proper position or try `Position Mode = Absolute`.
* Attaching `UIParticle` to the same object as `ParticleSystem`
* `Transform.localScale` will be overridden by `Auto Scaling` option.
* It is recommended to place `ParticleSystem` under `UIParticle`.
<br>
### Shader Limitation ### Shader Limitation
The use of UI shaders is recommended. The use of UI shaders is recommended.

View File

@ -326,19 +326,19 @@ namespace Coffee.UIExtensions
void ISerializationCallbackReceiver.OnBeforeSerialize() void ISerializationCallbackReceiver.OnBeforeSerialize()
{ {
m_IgnoreCanvasScaler = !m_AutoScaling;
m_AbsoluteMode = m_PositionMode == PositionMode.Absolute;
} }
void ISerializationCallbackReceiver.OnAfterDeserialize() void ISerializationCallbackReceiver.OnAfterDeserialize()
{ {
if (m_IgnoreCanvasScaler) if (m_IgnoreCanvasScaler)
{ {
m_IgnoreCanvasScaler = false;
m_AutoScaling = false; m_AutoScaling = false;
} }
if (m_AbsoluteMode) if (m_AbsoluteMode)
{ {
m_AbsoluteMode = false;
m_PositionMode = PositionMode.Absolute; m_PositionMode = PositionMode.Absolute;
} }
} }
@ -572,20 +572,31 @@ namespace Coffee.UIExtensions
{ {
if (!canvas) return Camera.main; if (!canvas) return Camera.main;
// Render mode is not ScreenSpaceOverlay, use world camera. // When render mode is ScreenSpaceCamera or WorldSpace, use world camera.
var root = canvas.rootCanvas; var root = canvas.rootCanvas;
if (root.renderMode != RenderMode.ScreenSpaceOverlay) if (root.renderMode != RenderMode.ScreenSpaceOverlay)
{ {
return root.worldCamera ? root.worldCamera : Camera.main; return root.worldCamera ? root.worldCamera : Camera.main;
} }
// Create ortho-camera. // When render mode is ScreenSpaceOverlay, use ortho-camera.
if (!_orthoCamera) if (!_orthoCamera)
{ {
_orthoCamera = GetComponentInChildren<Camera>(); // Find existing ortho-camera.
foreach (Transform child in transform)
{
var cam = child.GetComponent<Camera>();
if (cam && cam.name == "[generated] UIParticleOverlayCamera")
{
_orthoCamera = cam;
break;
}
}
// Create ortho-camera.
if (!_orthoCamera) if (!_orthoCamera)
{ {
var go = new GameObject("UIParticleOverlayCamera") { hideFlags = HideFlags.DontSave }; var go = new GameObject("[generated] UIParticleOverlayCamera") { hideFlags = HideFlags.DontSave };
go.SetActive(false); go.SetActive(false);
go.transform.SetParent(transform, false); go.transform.SetParent(transform, false);
_orthoCamera = go.AddComponent<Camera>(); _orthoCamera = go.AddComponent<Camera>();

View File

@ -149,7 +149,7 @@ namespace Coffee.UIExtensions
public static UIParticleRenderer AddRenderer(UIParticle parent, int index) public static UIParticleRenderer AddRenderer(UIParticle parent, int index)
{ {
// Create renderer object. // Create renderer object.
var go = new GameObject("UIParticleRenderer", typeof(UIParticleRenderer)) var go = new GameObject("[generated] UIParticleRenderer", typeof(UIParticleRenderer))
{ {
hideFlags = HideFlags.DontSave, hideFlags = HideFlags.DontSave,
layer = parent.gameObject.layer layer = parent.gameObject.layer

View File

@ -245,7 +245,7 @@ namespace Coffee.UIParticleExtensions
} }
} }
#if !UNITY_2020_3_OR_NEWER #if !UNITY_2021_2_OR_NEWER || UNITY_2020_3_45 || UNITY_2020_3_46 || UNITY_2020_3_47 || UNITY_2020_3_48
public static T GetComponentInParent<T>(this Component self, bool includeInactive) where T : Component public static T GetComponentInParent<T>(this Component self, bool includeInactive) where T : Component
{ {
if (!self) return null; if (!self) return null;
@ -261,23 +261,6 @@ namespace Coffee.UIParticleExtensions
return null; return null;
} }
public static T GetComponentInChildren<T>(this Component self, bool includeInactive) where T : Component
{
if (!self) return null;
if (!includeInactive) return self.GetComponentInChildren<T>();
var component = self.GetComponent<T>();
if (component) return component;
foreach (Transform child in self.transform)
{
component = child.GetComponentInChildren<T>(true);
if (component) return component;
}
return null;
}
#endif #endif
} }
} }

View File

@ -2,7 +2,7 @@
"name": "com.coffee.ui-particle", "name": "com.coffee.ui-particle",
"displayName": "UI Particle", "displayName": "UI Particle",
"description": "This plugin provide a component to render particle effect for uGUI.\nThe particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.", "description": "This plugin provide a component to render particle effect for uGUI.\nThe particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.",
"version": "4.1.7", "version": "4.2.0",
"unity": "2018.2", "unity": "2018.2",
"license": "MIT", "license": "MIT",
"repository": { "repository": {