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
0
Question by VIPINSIRWANI · Dec 24, 2013 at 04:49 AM · positionmodelpath

How To Re-use model Like Subway Surfer & Temple Run Game?

Hello Good Morning Everyone, I am working on 1 infinite run game then i need to reuse my model, I am confused how should i re-use my model again and again, like Subway Surfer and Temple Run Which technique should i use for path creation or reuse model ??

Please give me your suggestions or advice

Comment
Add comment · Show 1
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 robertbu · Dec 24, 2013 at 04:56 AM 1
Share

Here is one link on object pooling:

http://answers.unity3d.com/questions/321762/how-to-assign-variable-to-a-prefabs-child.html

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Drshk7 · Dec 24, 2013 at 04:54 AM

You could make something like it destroys it and instantiates it when you restart. Or, you can change the objects position to the starting point.

BTW: If this answer is not what you wanted, I suggest you should reword your question. What do you mean reuse? Like when you die you play again and the player model is there?

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 VIPINSIRWANI · Dec 24, 2013 at 05:26 AM 0
Share

No actually like Subway Surfer we cant use infinite model then our model have some limit then this model i need to use in same time again and again....Suppose my model Z start position is 0 and End Position is 10 now i want to use it up to z End Position 1000 then any good idea to do that??

avatar image
0

Answer by abduomar · May 01, 2016 at 05:31 AM

I think this should help you ;) https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/object-pooling

Comment
Add comment · 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
0

Answer by DevCas1 · May 13, 2016 at 04:51 PM

The object pooling thing could help. However, if you do not know where the first end ends, and the next end needs to begin, you need to find something for that. I tried to make an infinite runner myself, and I added an A and B point to every piece the player has to "run" over.

This way, you make it so that the B point of the next piece overlaps with the A point of the last piece. If used, the objects will ALWAYS fit together like a glove.

Adding the child A and B shouldn't be hard, as local positions are quickly done, and ALWAYS the same.

Code I used:

 public void Place()
 {
     GameObject lastUsedIndex = halfpipes[Random.Range(0, 5)];

     GameObject spawnedBlock = (GameObject)Instantiate(lastUsedIndex, spawnPos, Quaternion.identity);
     float nextZ = spawnedBlock.gameObject.GetComponentInChildren<Transform>().Find("A").transform.position.z;
     float lastZ = lastUsedIndex.GetComponentInChildren<Transform>().Find("B").transform.position.z;
     spawnPos.z = nextZ - lastZ;
 }

Hope it helps

Comment
Add comment · 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

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

20 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

Related Questions

Walk/run animation moves main camera up and down (first person) 1 Answer

MMD How to export model and animations to Unity as 3rd person controller? 2 Answers

How can I collect the positions of my waypoint objects which mark out a path or route? 2 Answers

Predicting path line affected by planet gravity. 1 Answer

How can I find the position of my weapon? 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