Quantcast
Channel: Questions in topic: "post processing"
Viewing all articles
Browse latest Browse all 713

Disabling / Destroying a camera component cause a black blinking / flickering on Android

$
0
0
I have this short piece of code to show a shockwave image effect. It works fine in the editor. But on android, when I call Destroy(this); I get a very short black blinkng of the screen. I've tried to replace Destroy(this); by this.enabled=false; but it does the same thing. Didn't try on iOS. If I remove this line, the screen doesn't blink. I'm totally stuck on this, any help, clue, or idea will be greatly appreciated. https://gist.github.com/jpsarda/33cea67a9f2ecb0a0eda using UnityEngine; using System; using System.Collections.Generic; // You call it like this : WaveExploPostProcessing.Get().StartIt(myVector2Position); public class WaveExploPostProcessing : MonoBehaviour { public Material mat; public WaveExploPostProcessing() { mat=new Material(Shader.Find("Custom/WaveExplo")); } protected float _radius; public float radius { get { return _radius; } set { _radius=value; mat.SetFloat("_Radius",_radius); } } public void StartIt(Vector2 center) { mat.SetFloat("_CenterX",(center.x+Futile.screen.halfWidth)/Futile.screen.width); mat.SetFloat("_CenterY",(center.y+Futile.screen.halfHeight)/Futile.screen.height); radius=0f; GoTweenConfig config=new GoTweenConfig().floatProp("radius",1.34f); //config.easeType=GoEaseType.ExpoOut; config.onComplete(HandleComplete); Go.to(this,0.6f,config); } protected void HandleComplete(AbstractGoTween tween) { Destroy(this); } static WaveExploPostProcessing _postProcessing; static public WaveExploPostProcessing Get() { WaveExploPostProcessing postProcessing=Futile.instance.camera.gameObject.AddComponent(); return postProcessing; } void OnRenderImage(RenderTexture src, RenderTexture dest) { Graphics.Blit(src, dest, mat); } }

Viewing all articles
Browse latest Browse all 713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>