What kind of Void should I use?
I want to make by bullet object to fly to the right when Player is looking at right, and fly to the left when Player is looking at left.
To do so, I added bool lookingRight = true; and made another script that I attached to my bullet object.
What I want to do is when bullet is Instantiated, let the bullet's script know if Player is looking right or left.
but if I use Void Start() or Void Awake(), it will only recognize the status of the Player at the very start of the game only.
So, to say it simple, What Kind of Void Should I Use To Get a Variable at the moment when the object the script is attached to is created??
Answer by ransomink · Dec 28, 2017 at 12:26 AM
Void has nothing to do with it. Void means the method/function returns nothing. When the bullet is spawned, that's when you tell it what direction the player is facing. (Get the variable right after instantiating. You should use pooling instead.) That's the only time it needs to know, so it can shoot the correct way...
Thanks. But I looked up at the scripting API and couldn't find anything about pooling. What is pooling? and How can I use it? Could you show me a very short example?
Pooling is something you have to create on your own. It's a godsend and very important if creating for mobile. Google "how to pool objects in unity", you'll get a bunch of hits and details about it...
Your answer
![](https://koobas.hobune.stream/wayback/20220612145334im_/https://answers.unity.com/themes/thub/images/avi.jpg)