Bullet Intersect Script Problem
How to make intersect script work Long story short, I have a bullet prefab which instantiates on purpose inside the body of my player and enemies. The problem is they detect this as an impact and lose health every time they fire a bullet. I was advised to add an intersect script which would mitigate this issue by only activating the damage only after a quarter of a second. But I can't get this script to work:
using UnityEngine;
using System.Collections;
public class BulletIntersect : MonoBehaviour {
// Use this for initialization
void Start () {
Bullet = this.gameObject;
}
// Update is called once per frame
void Update () {
time_bullet = Time.deltaTime;
//get array with all enemies
GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemies");
bool intersects_bool = false;
foreach(GameObject Enemy in enemies){
if(Bullet.Intersects(Enemy)){
intersects_bool = true;
}
}
if(time_bullet<Time.deltaTime+0.25f && intersects_bool==true)
}
}
I am getting the following errors: Unexpected symbol `}' for line 27 and Parsing Error for line 30. Please help me out with this? How do I make it work?
Answer by Avash · Feb 29, 2016 at 01:16 AM
You need a bracket in line 25 and a third bracket in the end.
Your answer
Follow this Question
Related Questions
Health and Damage Script Not Working 2 Answers
Huge Health and Damage Script Problem 0 Answers
error CS0103: The name `yourCharacter' does not exist in the current context 1 Answer
Error CS0177 - "GameManager does not contain a definition for 'GetPlayer' PLEASE HELP! 0 Answers
How to make health and damage script function correctly? 3 Answers