title: how to spawn prefab with filled scene gameobject fields
body: <p>when the prefab gets instantiated into the scene it loses the filled game object fields that were filled with scene items.</p>
  <p>here is the code im using:</p>
  <p>this is how to instantiate the player using photon servers (what i am using)</p>
  <pre><code>    public GameObject playerToSpawn;
          PhotonNetwork.Instantiate(playerToSpawn.name, spawnPoint.position, Quaternion.identity);
  </code></pre>
  <p>There are 2 buttons i need you to fix: a Shoot button and a Hit button (those are the names). Here is the code for them:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class ShootButton : MonoBehaviour
  {
  //i made this script for the button incase you may 
  have 
  needed it
  }
  </code></pre>
  <p>Here is the shooting script attached to the player:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class Weapon : MonoBehaviour
  {
  public Transform firePoint;
  public GameObject bulletPrefab;
  public Button ShootButton;
  
  void Start()
  {
      ShootButton.onClick.AddListener(ShootButtonTrue);
  }
  
  void ShootButtonTrue()
  {
      Shoot();
  }
  
  void Shoot()
  {
      Instantiate(bulletPrefab, firePoint.position, 
  firePoint.rotation);
  }
  }
  </code></pre>
  <p>Here is the hitting script attached to the Hit button</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class HitButton : MonoBehaviour
  {
  
  }
  </code></pre>
  <p>And here is the Player Combat script using for hitting:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class PlayerCombat : MonoBehaviour
  {
  public Animator animator;
  public Button AttackButton;
  public Transform attackPoint;
  public float attackRange = 0.5f;
  public LayerMask enemyLayers;
  
  void Start()
  {
      AttackButton.onClick.AddListener(AttackButtonTrue);
  }
  
  void AttackButtonTrue()
  {
      Attack();
  }
  
  void Attack()
  {
      animator.SetTrigger(&quot;Attack&quot;);
      Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, enemyLayers);
      foreach(Collider2D enemy in hitEnemies)
      {
          Debug.Log(&quot;u hit someone :O&quot;);
          enemy.GetComponent&lt;Health&gt;().TakeDamage(15);
      }
  }
  
  void OnDrawGizmosSelected()
  {
      if (attackPoint == null)
          return;
  
      Gizmos.DrawWireSphere(attackPoint.position, attackRange);
  }
  
  }
  </code></pre>
  <p>if you need any other pieces of code just ask</p>
  <p>thanks in advance, i will mark the answer as an answer if its a good answer</p>