
It looks like you're new here. If you want to get involved, click one of these buttons!
Hello, first I need to explain how my game works.
You are a Player (White circle) and a rocket spawn and follow a public target till it hits the target(the player) and destroy itself with help from a script.(All normal without any prefabs)
Then I created a GameObject with the name Spawner and the Spawner has a script to spawn a prefab every 3 seconds with help of youtube.
Then I make a prefab from my rocket and delete the 1 rocket from the Hierarchy. Then I add this rocket prefab to my Spawner.
My problem now is that
The rocket prefab doesn't have any target because I can't drag the Player from the Hierarchy in the target field. I could make a prefab from my Player and then add it to the target field but then my rocket doesn't follow the player prefab in the game.
How could I make it that the rocket prefab that always spawn follow a non prefab GameObject(My Player)?
I hope that I described it well and everyone can understand my problem.
Answers
Its as simple as anyone can think but it requires a script to be placed on the prefab object.so
Just reference your player to the spawner script and then when you instantiate the prefab rockets
Access their script and give them reference of the player that is already in the game
Something like
Man I tried and tried but I have not much experience to do something in this shit, I will give up thx for helping.
Dont give up bro i was a noob 6 months ago but now at least i can say that i can make anything but it takes time
Giving up is not solution just try ask us if you cant solve something
Yeah i understand, it's like: C# what do you want to understand this action xD
You know that only you can understand your game and that it's very difficult to explain other people your whole game or what you want to do
how did you learn C# i tried videos apps and websites but videos are after time boring and you dont learn what you need ,apps dont are effective and websites are the most with money
Look man c# and java are like twins
Every language has only 30 to 40 things to remember
And everything else is just a combination of that 30 to 40 things
All you have to learn is what does this thing do. Then make your own combination thats what we call a script.
Try with some basic algorithm like a function that returns multiplication or addison
Then after a while when you are sure about yourself that you can take thr next step then try some complexe algorithms like working with loops try Object Oriented Programming
Make some games like tictactoe snake game
Remember one thing all you have to do is make something everyday and practice all the time.
When i was new in programing i always thought that was is this someone just wrote something
But now everyday i wakes while solving bugs from yesterday
Hey @PlyfexHD
try this in the a script attached to your prefab
btw followscript just makes the missile follow the player name it according to ur sript(Give this script some name like EnemyPrefabManager)
And then add this to your follow script(Currently on your missile)
And just dont give up if u cant find an answer just keep on trying
Hope this will help u!!!!!!!!!!