Forgive me for asking this as I see it ask alot, yet…I still haven’t been able to find an answer that works for me. I’ve been at this all day. Like 8 hrs.
I have my player ship which is instantiated with my level. he reacts to the enemy weapon which tells him to instantiate explosion and destroy objects.
I have a game controll script on the game object it self (the entire game as a prefab) which is also instantiated. the control has two functions so far, reSpawn (re spawns player ship) or instantiate game over screen. both functions are called, but only one will work because of my if statement in relation to the remaining lives.
If lives are greater than 0 , it respawns.
My script idea worked great! But now I want my ship to just send the message to the game control script to execute those functions be for it self destructs. And you know -= a life!
now listen, I’ve read the documentation on all of the get component, get object, broadcast message, haha I’ve tired it all. But the dam thing won’t put the message through haha. I have a var with my main game object that the script is on, I I’ve tired in the start and awake function to do the gameObject.find, component.find, all that. And then in my on trigger, I state the path, but it’s not happening.
I know this is basic and pry really easy for one of you…how do I get the message through? How does player ship call that respawn or game over function on my game control?
Maybe there’s another way to manage this? Because next will be the points. I’ll want to add points, take a live away. Add a life.
I’m using Java btw
Object reference is not set to instance of object. Haha but I dragged it in the var, on start I said Game_1= gameObject.find (“game_1”) then I tested it with something simple like set active to false, but no go…
I’m so mad…I swear I’m going to shoot an invisible collider from the ship as it destroyed, it will smash into the game controller and tell it to do the dam functions haha…grrrr the worst part is I’ve done this befor, I don’t k ow why I’m having a hard time here…such a simple thing. .
If you are trying to find it in start, and you are getting a reference not set error, it means it probably didn’t find it. If you are dragging the reference in to var in the inspector, then you don’t need to do a find as well. Also, try posting your code, so we can see what you are actually doing. it may just be a simple mistake.
Please forgive me for posting a pucture. My work pc is not on line and my phone won’t connect to it. To send the code it self I’d have to take my SIM card out, and use a usb and a third computer to transfer lol…I’m having a he’ll of a time ;;;p

Do you actually have an object named “Game_1)” ? That looks like a typo.
Yeah it’s not reading it at all because it won’t even set active to false or any thing. I know the script I’m referencing works because I tested the functions . Null reference, not set to instance of object it says… oh I’m sure it’s a simple mistake. I’m sorry to even have to ask…but I’ve really tried here lol
Yes, like the whole game is a prefab, and that script is on it. well the coin screen, in Game_1 instantiates the levels
But does it actually have that parenthesis in the name? is it named Game_1 or Game_1)
Oh! Let me check. sorry I’m behind lol, I barely get signal here.
Omg…working like a champ now!..lololol. just forget you saw me…I’m going to die now.
Thank you VERY much for your time sir. You probably saved my life. I won’t hang my self in the shower now. …my cats thank you
No worries, that stuff happens all the time, it’s easy overlook when you have been staring at the code for a long time.
That was just something I tried and forgot to fully delete () lol. And it just didn’t catch my eye next to that for some reason. Haha Lesson learned. Thank you again friend.
