Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by devstudents · Jan 12, 2015 at 01:47 AM · scene-loadingnpcs

How to move a travelling npc accross scenes in real time

I'm working on a 3D top down rts/rpg project. To save memory, I'm going to divide the world into numerous scenes (like fallout 2, baldur's gate etc).

The problem I face with this is that I want active trade between different towns (located in different scenes) in the world. Moreover, I do not want this trade to be simulated but actual. For example, a cart travels from town A(scene 1), across country road X (scene 2), country road Y (scene 3) and then gets to town B (scene 4). The cart will leave town A with goods, gold or both and make transactions in town B leading to a change in the cart's inventory. When it returns to town A, the town's inventory will also change.

I do not know where to begin with solving this problem. A related problem is creating AI daily routines for a town's inhabitants and to have those routines continue even if the scene is not loaded. As far as I understand it, if a scene is not loaded then all scripts and gameobjects are also paused. Woodsmen and miners stop accumulating resources and fighters stop accumulating skill in the training grounds etc.

Sorry for the vagueness of this question. I hope it's clear what I'm trying to achieve. Any pointers in the right direction would be appreciated.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by getyour411 · Jan 12, 2015 at 01:52 AM

Regarding the scene not running, the way I've solved that is to have a static variable that's essentially a timer (independent of any one scene). When a scene is loaded, my functions look at the time delta and apply/increase/decrease things based on the time. I think you could use that approach to resolve a few of your issues.

For the problem of the cart, consider how are you going to make it move along this country road even with the scene loaded? Will you use an array of hidden gameobjects serving as waypoints that it moves to? If that's the case, you could use the time.delta again to estimate where along the path it might be.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image devstudents · Jan 12, 2015 at 02:32 AM 0
Share

Thanks a lot for your post. I'll start experimenting with your suggestions. It's good to hear that what I want to achieve is not totally impossible... but I can see myself running into a plethora of issues. The first one I can imagine having trouble with is animations, equipment and transforms.

Using the time variable I could make sure that that the npcs are far$$anonymous$$g or sleeping etc. at the right time when the player enters the scene, but I'm not sure how I'd get them to instantiate to right the place with the right equipment. NPCs have to get a tool from storage and then they find what to harvest based a manager script that records the locations of all the crops. They then move to the nearest crop and harvest until all the crops are harvested or it's time to stop. Perhaps there is too much detail in this design for a multi scene project.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Using parameters of activeSceneChanged? 0 Answers

Unity crashes after oping a scene from unity collaborate? 0 Answers

'Resource file has already been unloaded' error when exiting application in Editor 1 Answer

Scene freezes after loaded 1 Answer

How to transition from Load to scene ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges