I get an "Invalid assignment of property or key ‘fov’ with value of type float on a base object of type ‘null instance’ "
I know what the error means and I know how to fix it. I just need to pass in a float. However, in my script I can not find exactly where the error is originating. It lists 2 variables as coming back null. The variables are @group_3_camera and @group_8_third person. I don’t remember creating these variables. I have a feeling that this might be leftover code from earlier in the project. After looking through all of my code, I can not find the variables. They only appear in the stack when I run the project and go to switch the camera view. Or if I run multiple players. Other than this, the projects runs fine.
I am frustrated because this is an easy solution if only I could find where in the code to make the changes. I am probably missing something simple. Is there a way to find where the variable is located?
If you bring up a command line that has unix tools (so, any terminal on Linux or Mac, Cygwin or WSL on Windows), you can search with grep:
grep -r group_3_camera .
That will do a recursive search (-r) starting in the local directory (.). grep will look for the string group_3_camera in every file in that directory or any of its descendants, so if you call that at the root of your project it should find every file containing that string.
This can be useful if (say) you’re live-loading a script somewhere, or if (as has occasionally happened to me) Godot’s cache has gotten out of sync with reality.
Thank you for your advice! I tried this method and it confirms that there is a group 3 camera. It won’t give me the exact location though. I am wondering if a Spring arm could create a variable during run time to try ti interpolate between the 2 cameras.
I wanted to double check in case it is user error on my part. When I search, it gives me the main project folder. Maybe I am doing something wrong? I am pretty new at this method and to Godot in general.
You’re doing it right, but the results seem to indicate no matches. I bet if you try:
grep -rl group_3_camera .
you’ll just get:
.bash_history
The -l flag for grep (lower case L) means “just show what files contain matches”. It looks to me like the only matches for group_3_camera are actually from you typing in grep commands and it getting recorded in your shell history.
You should make sure you run grep in the project directory, though.
When I use the search function inside Godot, It comes up empty. I will post a photo of the error on the offchance that based on the code I have written you might notice an issue. When the error happens, it takes me to a blank line in the code.
I can’t find the direcxtory while using WSL. It keeps coming up saying no such file or directory exists. I feel like this is something I am doing wwong with the commands.
Do you have anything close to a variable named group_3_Camera, or maybe you are seeing internal variables for groups, so do you have a group named “Camera”?
Do you get any errors? Can you share the exact line of code with the error?
I know it is a null error. I know how to fix the error. I just can’t find this camera group in order to fix the error. I appeciate you taking the time to help!
Why do you need the camera group? How is third_person_camera defined/assigned? Seems like it must be an @export as you don’t have any camera children in the player scene, did you assign the @exported variable in your game scene?
Make sure to paste code instead of screenshots where applicable
If you are using a group, and assigning third_person_camera on ready, then the other camera may not have been ready/added to the group yet, you will have to wait until the cameras are loaded and in the group; either by await get_tree().process_frame, or just before you need to use third_person_camera.
I created the group thinking this would be the best way of assigning it because I was instantiating a camera, but I ended up finding another way of doing that through creating an instance of it in the script and assigning the instantiated object to that. You make a good point. I will post the whole script and maybe it will be easier to catch my mistake. A big thank you to everyone who has been helping me. It is very much appreciated!