- Home /
Question by
alemimi · Dec 21, 2013 at 09:24 PM ·
ontriggerenterframecalllate
Call OnTriggerEnter a frame later
Is there any way to call OnTriggerEnter and wait 1 frame before getting a collision? I'm trying to get if an object is colliding or not with another object right after being instantiated.
My code so far:
using UnityEngine;
using System.Collections;
public class ProceduralObjectsChild : MonoBehaviour {
bool collided = false;
// Use this for initialization
void Start () {
StartCoroutine(CheckForCollision());
}
// Update is called once per frame
void Update () {
}
void OnTriggerStay(Collider other){
collided = true;
}
IEnumerator CheckForCollision(){
yield return null;
if(collided){
SendMessageUpwards("CollisionWithOtherWall", SendMessageOptions.DontRequireReceiver);
}
Debug.Log (collided);
}
}
The variable "collided" returns always false, where should return true, any ideas?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613124634im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Problem with trigger collider and damage function not hitting on the same frame 1 Answer
Why doesn't the OnTriggerStay2D run? 2 Answers
Get WHICH trigger for OnTriggerEnter? 1 Answer
On Trigger Enter, Collide with object, specific collision 1 Answer
Can CollisionFlags and OnTriggerEnter work together? 0 Answers