|
Post by claudius on Dec 29, 2016 17:23:18 GMT
So, I tried to put all my system in an additive scene instead of having a copy of the system on every scene. However now I have the problem that the GameManager is not designed to be used this way. How can I modify the code to make the manager find the spawner by name/tag on start rather than assigning it? My attend to do so failed so for (but it is not surprising, I only have some really rudimentary coding skill).
|
|
|
Post by Invector on Dec 29, 2016 19:12:21 GMT
Hmm I never used additive scene, but you could use this on the awake or start methods of the gamecontroller
spawnPoint = GameObject.FindGameObjectsWithTag("tag");
|
|
|
Post by claudius on Dec 29, 2016 20:02:46 GMT
I guess it mean that i have to add the extra step to get the transform of the gameobject and then set spawnPoint this transform ?
|
|
|
Post by Invector on Dec 30, 2016 13:51:35 GMT
you can add this line above the "var player..."
spawnPoint = GameObject.FindGameObjectWithTag("Respawn").transform;
|
|
|
Post by claudius on Dec 30, 2016 15:44:03 GMT
Ah, it was so easy. Well, it's working now. It made me mad, that I was often so close of the solution. I know that an large part of learning coding is to search documentation, but danm, I rarely find the unity documentation usefull.
|
|
|
Post by Chronicman on Dec 30, 2016 22:25:05 GMT
|
|
|
Post by dreadlord on Jan 6, 2017 21:02:46 GMT
you can add this line above the "var player..." spawnPoint = GameObject.FindGameObjectWithTag("Respawn").transform; #if UNITY_5_4_OR_NEWER
SceneManager.sceneLoaded += OnLevelFinishedLoading;
#endif
spawnPoint = GameObject.FindGameObjectWithTag("Respawn").transform; var player = GameObject.FindObjectOfType<vThirdPersonController>(); Why is this only executed at the first start. When i load a new scene its not executed again. I do not want to put this into Update.
|
|
|
Post by jgiroux on Jan 6, 2017 22:02:19 GMT
Youtube is also a surprising effective search means for all things unity!! just remember to search *in* youtube and not with google just type "unity how to" + (the question you are looking to have answered.)
|
|
|
Post by dreadlord on Jan 6, 2017 23:03:28 GMT
got it
|
|