Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
silasfriedrich

Get position of a cube in a other scene

Question

Hi everyone,
I need a little help by something that i cant get work. Im totally a beginner in scripting and unity :((  and want to do a small android game. So i have a  cube in a scene that can be moved and rotated by the touchscreen, now in a other scene I have the same cube and I want that if the cube in the first scene gets moved the other cube goes to the exact same lovation.
I hope anyone can help me.

 

thanks

 

Edited by silasfriedrich

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

if its the same cube you want kept, just use DontDestroyOnLoad (Please login or register to see this link. ) stops the cube being deleted when opening a new scene :)

 

otherwise, save the position to playerprefs and then just get it in the next scene (Please login or register to see this link. )%C2'>

  • Like 1

Share this post


Link to post
Share on other sites

  • 0

Game object position is stored in vector3 (x,y,z), which is stored in transform, and transform is stored in box called GameObject. To access or change gameobject position in 3d space use gameObject.transform.position. If you use dontdestroyonload, that gameobject wont be destroyed, that is - his coordinates will be the same as in scene1, so there's really no need to set anything as its its position will be the same on new load.

  • Like 2

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

have you ever thought of tutoring? your explanations are always very good :) 

 

+1

  • Like 2

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

Thanks, i appreciate that. In fact i have, and lately i have been thinking about it even more. But reality is, i wake up, eat breakfast and rest of the day spend working on the project, drawing data flow diagrams (everything related to that). When i am in developing rush, you cant really switch to something else, like creating tutorials or going outside and taking a walk or something. 

 

Plus, there is already ton of tutorials, so only thing worth making would be about things people are having most problems with, like getcomponent, gui or explaining logic about picking stuff up, best ways of managing data storage, etc. Because the hardest part is not to code something, but learn how to think how to code something. 

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

Thats.. thats deep man :0 I see programming just as problem solving, it's just a digital reality and we have to tackle the problems of gaming like any other situation: thinking and then acting, making mistakes and learning so we do better next time

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...