How to make a game object from several game objects in Unity?

Dear Stackoveflow fourm I have programmed a great music game. Unfortunately there is a problem. In my game there are so many objects that my smartphone can’t load the game properly. I have nowhere to find out how to make an object out of many objects. If someone knows how to do it I would be very happy!

My Script:

   using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;  public class line : MonoBehaviour {          //Please attach me to the line, then set  dline,tail,mcamera,road,decorates,dieeff.     //You can add more to make this better!     public GameObject dline, tail, mcamera, road, decorates, dieeff;      private GameObject tempgo, tempdia, tempcr;      public bool direction, alive, start, load, roadmaker;      public float cameraspeed, temprm;      public Vector3 offset, tempcrgo;      private GameObject[] dia, cr;      List<GameObject> go = new List<GameObject>();      void Start()     {         start = false;         load = true;         alive = true;         //find diamonds and crowns         dia = GameObject.FindGameObjectsWithTag("dia");         cr = GameObject.FindGameObjectsWithTag("crown");         //     }      void Update()     {         if (load == true)         {             //save the initial distance between camera and line             offset = mcamera.transform.position - dline.transform.position;             cameraspeed = 0.03f;             load = false;             //         }         //restart         if (Input.GetKeyDown(KeyCode.R) == true)         {             SceneManager.LoadScene("main");         }         //         if (start == false && alive == true)         {//start game             if (Input.GetMouseButtonDown(0) == true || Input.GetKeyDown(KeyCode.Space) == true)             {                 start = true;                 dline.GetComponent<AudioSource>().enabled = true;             }          }//          if (start == true)         {//turn             if (Input.GetMouseButtonDown(0) == true || Input.GetKeyDown(KeyCode.Space) == true)             {                 if (direction == true)                 {                     direction = false;                 }                 else                 {                     direction = true;                 }             }         }//          //build road/wall more efficiently         if (roadmaker)         {             temprm += 1;             //why there is temprm?to reduce the ammount of roads             //why build one when click?to ensure there is road/wall when line turns(or it will look weird)             if (temprm % 6 == 1 || Input.GetMouseButtonDown(0) == true || Input.GetKeyDown(KeyCode.Space) == true)             {                 GameObject.Instantiate(road, dline.transform.position + new Vector3(3, 0, -3), dline.transform.rotation);                 GameObject.Instantiate(road, dline.transform.position + new Vector3(-3, 0, 3), dline.transform.rotation);             }// // //         }         else         {//when you play ...I dont put the part in Update but if(roadmaker) because these actions will create new gameobject and interfere the copying of road             GameObject.Instantiate(tail, dline.transform.position, dline.transform.rotation);             if (Input.GetMouseButtonDown(0) == true || Input.GetKeyDown(KeyCode.Space) == true)             {                 if (direction == true)                 {                     go.Add(GameObject.Instantiate(decorates, dline.transform.position + new Vector3(8, -9, -5), dline.transform.rotation));                 }                 else                 {                     go.Add(GameObject.Instantiate(decorates, dline.transform.position + new Vector3(-5, -9, 8), dline.transform.rotation));                 }             }         }//     }      void FixedUpdate()     {//smooth camera         mcamera.transform.position = Vector3.Lerp(mcamera.transform.position, offset + dline.transform.position, cameraspeed);         //         //some 'animations' .I didnt use animation component because I dont know how it works in Unity :(         foreach (GameObject tempgo in go)         {             tempgo.transform.position += new Vector3(0, 0.2f, 0);         }          foreach (GameObject tempdia in dia)         {             tempdia.transform.localEulerAngles += new Vector3(0, 2, 0);             if (Mathf.Abs(dline.transform.position.x - tempdia.transform.position.x) < 1 && Mathf.Abs(dline.transform.position.z - tempdia.transform.position.z) < 1 && tempdia.transform.localScale.z > 0)             {                 tempdia.transform.localScale -= new Vector3(0.3f, 0.3f, 0.3f);             }         }         foreach (GameObject tempcr in cr)         {             tempcr.transform.localEulerAngles += new Vector3(0, 2, 0);             if (Mathf.Abs(dline.transform.position.x - tempcr.transform.position.x) < 2 && Mathf.Abs(dline.transform.position.z - tempcr.transform.position.z) < 2 && tempcr.transform.localScale.z > 0)             {                 tempcr.transform.localScale -= new Vector3(0.26f, 0.26f, 0.26f);                 tempcrgo = tempcr.transform.position;             }             if (tempcr.transform.localScale.z <= 0)             {                 tempcrgo += new Vector3(Random.Range(-2f, 2f), Random.Range(-1f, 2f), Random.Range(-2f, 2f));                 tempcr.GetComponent<Light>().enabled = true;                 tempcr.transform.position = Vector3.Lerp(tempcr.transform.position, tempcrgo, 0.02f);              }         }         //         if (start == true && alive == true)         {//how the line move             if (direction == true)             {                 dline.transform.position += new Vector3(0.3f, 0, 0);             }             else             {                 dline.transform.position += new Vector3(0, 0, 0.3f);             }         }//     }      void OnCollisionEnter(Collision x)     {//when die...         if (x.collider.tag == "wall")         {             alive = false;             mcamera.GetComponent<AudioSource>().enabled = true;             dieeff.SetActive(true);         }//           //when complete the level...         if (x.collider.tag == "Finish")         {             offset = offset + offset + offset + offset;             cameraspeed = 0.01f;         }//     } } 


Game Scene

Video Link:

Bullets Stop when Shooting Unity 2D

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class Makarov : MonoBehaviour {     public GameObject Bullet;      public float BulletSpeed;      public Transform ShootPoint;      // Update is called once per frame     void Update()     {         if(Input.GetMouseButtonDown(0))         {             shoot();         }     }      void shoot()     {         GameObject BulletIns = Instantiate(Bullet, ShootPoint.position, ShootPoint.rotation);         BulletIns.GetComponent<Rigidbody2D>().AddForce(BulletIns.transform.forward * BulletSpeed);     } } 

When I shoot the bullets just stop right in front if the gun. This is for a top down shooting.

GLES3 – GL_INVALID_OPERATION: Operation illegal in current state (Unity Android native)

I use Unity(editor 2020.1.8f1). My application use android native .so lib that use GLES3. In order to use it first of all I have done these steps :

first: go to Project Settings >>> Player >>> Other Settings.  second: find "Auto Graphic API" and uncheck it.  third: Now you can see a new panel just below the "Auto Graphic API". It's a list of "Graphics APIs". Remove all graphics APIs and just add "OpenGLES3". 

Then in android CMakeList.txt file I marked that I use GLES3

... target_link_libraries(         libcocodec         GLESv3               <----------------  THIS LINE         decoder_engine_lib         $  {log-lib} ) ... 

And there is a usage :

void RenderAPI_OpenGLCoreES::EndModifyTexture(         void* textureHandle,         int textureWidth,         int textureHeight,         int rowPitch,         void* dataPtr,         bool destroy) {     GLuint gltex = (GLuint)(size_t)(textureHandle);     // Update texture data, and free the memory buffer     glBindTexture(GL_TEXTURE_2D, gltex);          GLenum format = GL_RG;      glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, format, GL_UNSIGNED_BYTE, dataPtr);     if (destroy)         delete[](unsigned char*)dataPtr; } 

and error message I get is –

2020-11-08 10:51:46.966 1512-1930/ E/Unity: OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_OPERATION: Operation illegal in current state      (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 358) 

I assume that something wrong with usage of GLenum format = GL_RG;, because (just for test) – if I use GLenum format = GL_ALPHA; I don’t get any errors (as well as expected result). Looks like gles3 doesn’t know what is GL_RG format.

What am I doing wrong?

what is use of ScriptableSingleton in Unity?

in unity 2020.x Unity just has introduced scriptable Singleton. a class that derives from Generic Class Called ScriptableSingleton its like singleton but you only can have single instance of it and seems to be good for ScriptableObjects that need to be Forced to be Single. but there are some differences.

they can be project Specific or Shared. they can get any format and unlike usual scriptableObjects they have no visualization in the inspector. the question is how should i use them and they are appropriate for which approaches? this is the link to the reference:

What is the Unity 2019.3.5 version of `UnityEngine.UI.Text`?

I was following a tutorial on how to create a dialogue Box in Unity, and in one part of the tutorial the tutor imports UnityEngine.UI and creates an object of type Text, but my version of Unity is 2019.3.5f1 and I learned through searching a bit online that this UnityEngine.UI doesn’t exist anymore in this version, and that it was replaced with UnityEngine.UIElements, and this Text type doesn’t exist anymore as well.

I couldn’t find a replacement for Text or what is the new nomenclature, nothing from trying stuff that popped in the auto complete or searching for answers in the Internet gave me answers. Maybe I just searched poorly, but if anyone happens to know, could you kindly answer?