I'd like to create a script that displays prediction lines when I drag the mouse, but I'm currently using Ball as the object I want to display prediction lines and GameObject as the object I attached the script to.
Is there a way to use Ball in the OnMouseDown method?
Also, there are other code descriptions, so I don't want to change the object to which I want to attach the script from GameObject if possible.
If anyone knows, please let me know.
c# unity3d
The instructions for finding objects are as follows:
GameObject ball=GameObject.Find("Ball");
Note that it is not recommended to use this function every frame because this process is heavy.
There are several other ways to retrieve it, but I think you can get information by searching the web around "Find unity Object".
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
917 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.