How to send a game object name to another script.

All I need to do is try and send a Game Object’s name to another script.

Script1.js

static var CurrentObject = this.gameObject.name;

Script2.js

var getObjectName = Script1.CurrentObject;

It doesn’t work, because when you’re declaring static variable it has nothing to do with actual instance of a gameObject… try something like this:

static var CurrentObject = "";
    
    function Start(){
    CurrentObject = this.gameObject.name;
    
    }