I have a bullet script that I want to use the GameObject that created it.
The bullet’s creation:
GameObject projectile = (GameObject)Instantiate(bullet, transform.position, transform.rotation);
projectile.GetComponent<bulletController>().parent = gameObject; //Trying to set the GameObject variable parent
NetworkServer.Spawn(projectile);
The bullet uses it so that you can’t shoot yourself. This is the current line, but ideally, I wouldn’t need the GetInstanceID() because you can compare 2 game objects. if (hit.name.Contains("Character") && hit.GetInstanceID() != parent.GetInstanceID())
For some reason, you can still shoot yourself…