Bolt Instantiate - Sceneobject reference

Options
Hello,
I have a small problem

I want to instantiate a bullet which moves forward (done)

But this bullet diesnt get the reference to the player (GameObject.find) doesnt work since theyre called all the same (Player Clone)

BoltEntity entity = Boltnetwork.instantiate....
Entitiy.getcomponent........... = player(is referenced in my gun object) doesnt work also, its just "nothing" in the editor window...

I need it to get the speed and damage from the player and to send the exp from the attacked object if it gets destroyed...

Best Answer

Answers

  • stanchion
    Options
    Can you clarify what you're trying to do?
  • SynterGames
    Options
    public void Shoot() { foreach (Transform gunpvt in gunPivots) { BoltEntity shot = BoltNetwork.Instantiate(BoltPrefabs.Bullet, gunpvt.position, gunpvt.rotation); shot.GetComponent<BulletMovement>().player = player; }

    Basically i am instantiating an bullet, which moves forward
    And i want the "player" variable be assignet with the shooting player (Player)
    But it tells me always "Object reference not set"
  • stanchion
    Options
    Is your game server authoritative? Is this code being run on the host and the client?
  • SynterGames
    Options
    Ahm no idea :smiley:
    The server is a player... if that helps somehow...
  • stanchion
    Options
    Who owns players in your game, client or the host?
  • SynterGames
    Options
    In short: i have no idea... just started adding stuff like transform replication and variables - nothing more
  • SynterGames
    Options
    Tryed already to set it as entity state but that doesnt work either

    But im going to look deeoer first in everything, its the best i think :D