Answer the question
In order to leave comments, you need to log in
How to change the size of an object when moving to another scene?
There is a character customization menu, as you probably already understood, you need to save all customization changes, transfer the same object directly to the scene with the game itself, for this the simplest DontDestroyOnLoad function is used, the script is exactly the same as here: docs.unity3d.com/ ScriptReference/Object.DontDestro...
The problem is that the character is too big in the other scene, what changes should be made to the script to bring it, but already in a small size?
PS: I also added a camera to the character in the customization menu and turned it off, again, what needs to be entered in the script so that when the object is transferred to the next scene, it turns on?
Answer the question
In order to leave comments, you need to log in
The most obviously simple option is to keep the same scale in both scenes (and there will be fewer problems in the future)
And if through a script, then "adjust" the scale with handles.
https://docs.unity3d.com/ScriptReference/Transform...
void Example() {
transform.localScale = new Vector3(5, 5, 5);
}
public class ExampleClass : MonoBehaviour
{
//назначить в редакторе или в Awake() методе найти главную камеру
//сам факт получить ссылку на камеру
public GameObject cameraGO;
void OnLevelWasLoaded(int level) {
if (level == 13)//номер уровня или проверку по имени сделать
{cameraGO.SetActive(true);}
}
}
There is a character - an object.
There is its size, this state. The State
pattern suggests itself .
On loading the scene, you can substitute the state you need for the object, and it will change.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question