I'm trying to show particles' effect on my UI. Then I came across this post: Unity Particle Effects On Canvas And I followed every step, but the particles are not shown on the canvas when I click play for some reason.
[My Particle Camera components][1] [My Hierachy][2]
I just followed the steps shown in the post, so my script is basically identical:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Particle_Camera_Script : MonoBehaviour
{
// Here reference the camera component of the particles camera
[SerializeField] private Camera particlesCamera;
// Adjust the resolution in pixels
[SerializeField] private Vector2Int imageResolution = new Vector2Int(256, 256);
// Reference the RawImage in your UI
[SerializeField] private RawImage targetImage;
private RenderTexture renderTexture;
private void Awake()
{
if (!particlesCamera) particlesCamera = GetComponent<Camera>();
renderTexture = new RenderTexture(imageResolution.x, imageResolution.y, 32);
particlesCamera.targetTexture = renderTexture;
targetImage.texture = renderTexture;
}
}
Any help will be much appreciated. Thank you for reading this. [1]: https://i.sstatic.net/alNAL.png [2]: https://i.sstatic.net/XtbtH.png
I tried @Iggy method and it seems to work fine. I just had to download a package then I was ready to go. https://github.com/mob-sakai/ParticleEffectForUGUI
I don't know why this post got a dislike, but whoever disliked could at least tell me why, so I can at least improve.