Question by
Arkain · Jun 19, 2017 at 05:34 PM ·
instantiatetransformscript.
C# How to choose a Transform value without drag it from asset folder, only with script ? (sorry the question is not clear)
Hello from France !
Well, no, my question is not "how to modify transform.position with script" but i don't really know how to explain it clearly and easily, however i'm gonna try.
Actually, what I want to do is basically instantiate a bullet. Usually, I use something like that :
public Transform bullet;
public void CallBullet (){
Instantiate(bullet, transform.position, transform.rotation);
}
and I just drag the bullet i created from asset folder to the inspector. However, i would like to do it with script. So i was thinking something like :
public Transform bullet;
public void CallBullet (){
bullet = Resources.Load("fireball") as Transform; // But this does nothing
Instantiate(bullet, transform.position, transform.rotation);
}
So I don't know what to write at this line. If I am clear enough, and if someone has a solution or an idea, he would be welcome ! (Sorry for bad english)
Comment