so im trying to write a script for my game so i can detect objects and interact with those objects but I’m getting two different errors at the moment, the first is when i type the code as it is in the tutorial.
Error could not find type “interactable” in current scope
to be used in keyword is it must be a Type, not a variable. You can create a Type with class_name Interactable, best to use this on your base interactable script.
so i took the class_name interactable out of the object script and rewrote what you put into the raycast so now its class_name Interactable extends RayCast3D.
this code works kinda. it loads the game but it still isn’t recognizing my objects or having my prompt text pop up which is what i want to happen. i have the lable set up as prompt in the script.
im thinking ill have to rewrite that part of the script using a ready function? or should i try a diffrent method all together
It sounds like you did class_name Interactable on your InteractRay script? You can’t if detected is Interactable if your thing detecting is itself the Interactable. I notice a “lockersInteratable” script in your panel, that is probably the on you want to be declared class_name Interactable
see i try that but it says it hides a global scrip class and when i add extends to static body it say the same thing. idk how it worked the first time honesty.
i think imma try a work around or do a new project to see if th error continues
It’s because class names can’t be declared twice. Adding a class_name is a global operation, it affects the entire project, you cannot have two class_names that are the same within a single project.
Only your locker or base interactble should have class_name Interactable extends StaticBody not the InteractRay