Quantcast
Channel: Questions in topic: "scanner"
Viewing all articles
Browse latest Browse all 14

Trigger 2D not working

0
0
I'm working on a game that looks like an old submarine radar. There is the scanner that goes around the dial and when it hits an enemy, they become visible for a brief moment. Unfortunately, I can't get the OnTriggerEnter2D to work when I attach this script to the enemy. var fadeSpeed:float=5; function Update(){ if(gameObject.renderer.material.color.a>0) gameObject.renderer.material.color.a-=fadeSpeed*Time.deltaTime; } function OnCollisionEnter2D(coll: Collision2D) { if (coll.gameObject.tag == "Scanner"){ gameObject.renderer.material.color.a=100; transform.position.x=100; } }

Viewing all articles
Browse latest Browse all 14

Latest Images

Trending Articles





Latest Images