InvokeRepeating problem
Hello, I'm beginer in Unity and i have a problem with the invokeReapeating tool. I try to recreate a image (UI) with BoxCollider and Rigidbody but the clone image is visible in the hierachy and invisible in the game. This my programme : .thanks for the help !
using UnityEngine;
using UnityEngine.UI;
public class Generate : MonoBehaviour
{
public Image Obstacle;
// Use this for initialization
void Start()
{
InvokeRepeating("CreateObstacle", 1f, 1.5f);
}
void CreateObstacle()
{
Instantiate(Obstacle);
}
}
Answer by Dave-Carlile · Dec 18, 2015 at 03:28 PM
Switch over to the scene tab while the game is running, then double click on the clone in the hierarchy. That will show you where the object is being created in the scene. Where is it relative to the camera? It's most likely not within the the camera's view. Generally when you instantiate an object you have to specify a position to put it at.
Hi Dave Carlile and thanks for the help, When i double click on the clone in the hierachy, the coordinates x, y and z change and i want only image affected by gravity. You think i must specify ? {Instantiate (Obstacle, transform.position, transform.rotation); }
PS : I'm french so excuse me for the mistakes
Your answer
Follow this Question
Related Questions
Share Image Android / iOS 1 Answer
Losing image quality in Android after build 2 Answers
Black screen before launch image/splash screen 2 Answers
Display problem after build to Anroid - SOLVED 2 Answers
Take a Picture and Save Using Camera App 0 Answers