- Home /
UA does not write nor find script to specifications.
Instantiate at mouse in empty space 2D
I've read a bunch of threads on this but I can't get them to work. I have a Ship prefab, that the main camera focuses over. When the ship is destroyed, the camera gets confused and logs an error. I want to be able to create another ship where I click. This seems silly for a game, but my college instructor said that there needs to be mouse input for the project, so this is what I wanted to do for that.
I need the script, but also need instructions on how to use it. For the other scripts I've found elsewhere, I just attached them to the camera because I wasn't instructed otherwise.
If I have to, I'm willing to create an invisible plane underneath everything. Some others mentioned something like that. Detailed instructions though please.
This site is not for people to write a script for you and then give you instructions on how to use it. This site is to help you script your own solutions. You are now seeing the problem with trying to build an app using found scripts. Sooner or later you run into a problem that will require either modifying the scripts or writing a new script.
As for solving your problem, almost all camera scripts that follow or focus on a target have reference in the script to that target. You are destroying the object that is the 'target' for the camera. You have two main choices:
Learn how to dynamically assign a new target to the camera. You may also have to modify or disable the camera script during the time there is no target.
Change your script so that you ship is not destroyed but is ins$$anonymous$$d reused. Again you may have to modify or disable the camera.
That wasn't even my problem, actually, that was something I mentioned. And by co$$anonymous$$g on here and abusing your power like all moderators, you have not helped me at all in my VGD career, rather you have stolen an opportunity for me to learn for no good reason, and you've pissed me off. To further exert your power, I suspect you'll ban me, as opposed to swallowing your pride. So fuck you, I'll look for help on other forums. Thanks.
I'm sorry you were angered by closure of your question. No one is going to close your account just because you disagree with a closure, but before you make broad allegations and be abusive, you should make an effort to understand why your question was closed. Every forum is different with both explicit and implied rules. Primarily this line in your question sealed its fate:
I need the script, but also need instructions on how to use it.
This is a hot button issue on this list since we have a lot of students and non-programmers trying to get the participants on this list to write code for them rather than take the time and effort to understand coding and concepts and so they can write the script themselves.
In addition, while you claimed to have "read a bunch of threads." You did not bring anyting to the table. The question of how to find a world position given a mouse click has been answer 1000's of times on this list. It is two lines of code (not a script) if the camera is axes aligned. It is five if the camera is at an arbitrary angle. Showing us your attempts to use any one of the 1000's of posts, whould have had your question accepted.
Finally, your comments about 'scripts found elsewhere' indicated that you are trying to build your apps by taking ready-made scripts and attaching them without understanding how they work. Again, this list is about helping you write your own code, not about ready-made scripts.
As for other forums, I occassionally find Unity questions answered on StackOverflow. Also there is a sister site to UA: Unity Forums. They have a discussion format. Good luck on your project.
I'm so sorry, I feel like a jerk now. I know you were just doing your job. I guess I was already having a bad day, sorry if I ruined yours. I'll never blatantly ask for script again, besides, now that I think of it, that does seem kind of self centered.