Quantcast
Viewing latest article 2
Browse Latest Browse All 19

maintain script on different scenes

How can I maintain script which is attached to the game object over different scene.

GameObject testobj;

void Start()
{
      testobj = new GameObject("Test");
testobj.Addcomponent<TestScript>();
}

how can I maintain TestScript which contains the connection to the server and don't want to lose during the next scene loading.

DontDestroyOnLoad(testobj) doesnt work.


Viewing latest article 2
Browse Latest Browse All 19

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>