Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unity Prefabs not getting into build

Discussion in 'Editor & General Support' started by oksooooo, Jul 9, 2022.

  1. oksooooo

    oksooooo

    Joined:
    Jun 26, 2021
    Posts:
    3
    i have prefabs that are not in the game scene and not showing up in the build pls help me get them in the build
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,455
    Can you be more specific? Do you instantiate them? What code is used? What unity version?
     
  3. oksooooo

    oksooooo

    Joined:
    Jun 26, 2021
    Posts:
    3
    I instantiate them and this is the code but pls be advised i use rugbug redferns FPS tutorial series
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Photon.Pun;
    5. using System.IO;
    6. using Photon.Realtime;
    7.  
    8.  
    9. public class PlayerManager : MonoBehaviour
    10. {
    11.     PhotonView PV;
    12.     GameObject controller;
    13.  
    14.     void Awake()
    15.     {
    16.         PV = GetComponent<PhotonView>();
    17.     }
    18.  
    19.     void CreateController()
    20.     {
    21.         Transform spawnpoint = SpawnManager.Instance.GetSpawnpoint();
    22.         Debug.Log("PlayerController Instantianted");
    23.         controller = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PlayerController"), spawnpoint.position, spawnpoint.rotation, 0, new object[] { PV.ViewID });
    24.     }
    25.  
    26.     void Start()
    27.     {
    28.         if (PV.IsMine)
    29.         {
    30.             CreateController();
    31.         }
    32.     }
    33.  
    34. i am also using photon
    35.  
    36.  
    37.     public void Die()
    38.     {
    39.         PhotonNetwork.Destroy(controller);
    40.         CreateController();
    41.     }
    42.  
    43.     public static PlayerManager Find(Player player)
    44. }
     
  4. oksooooo

    oksooooo

    Joined:
    Jun 26, 2021
    Posts:
    3
    here's a video link: