Quantcast
Channel: Questions in topic: "dontdestroyonload"
Viewing all articles
Browse latest Browse all 416

Unity 2d select 2 object on another 2 scenes

$
0
0
Hi, my name is Taha. **I wanna select 2 object in a script but this 2 object is on another 2 scenes.** I add a *DontDestroyOnLoad();* If scene is 0 happend anything, If scene is 1 happend anything. How can i do that or can i do that? my code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class game : MonoBehaviour { public GameObject object1;//object on first scene public GameObject object2;//object on second scene public float scene; private Rigidbody2D rb1, rb2; void start() { rb1 = object1.GetComponent(); rb2 = object2.GetComponent(); DontDestroyOnLoad(gameObject); } void update()//this is a example { if (scene == 0) { //bla } if (scene == 1) { //bla } } }

Viewing all articles
Browse latest Browse all 416

Trending Articles



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