Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 tutiplain1 · Sep 09, 2017 at 08:46 PM · instantiategameobjectsclone

Cloned objects not appearing in game while in play mode

Hi all,

I just upgraded to Unity 2017.1. After upgrading my project, I tried to run it. I have a logic to instantiate 3d "tile" objects. The logic consists of doing GameObject.Find() to find the original object pre-fab in the scene, and then instantiating many times over in the different locations. This always worked in unity 5.1. Now, after I upgraded the project, the objects get instantiated, but I can't see them when in game mode. I can see them in the hierarchy, and if I pause the game (while running in Editor), they become visible. Only when the game is running do they disappear. If I export the game, the exported game doesn't show the objects either. I tried every possible combination of shaders to see if maybe something in the shader was preventing the objects from rendering, but nothing. All the cloned objects have their Mesh Renderer on, so that's not problem either. Can anyone help?

-EDIT- The issue is not related to Unity 2017.1, it also happens on Unity 5.5.

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
0

Answer by tormentoarmagedoom · Sep 10, 2017 at 05:11 PM

This is so strange... i really don't know why this happens. I just upgraded to 2017 and except for some little things, all is working fine. And i use Instantiate a lot of times and i see no problems.

Did you made a backup before upgrading? I recommend you to downgrade your unity again, check at last version you had if is still working, and do the upgrade again... maybe some code from unity went corrupted.

I normally Instantiate from a prefab, by its string name in my folder Assets/Resources. Is where i have all the prefabs, textures... everything that will be need "Loaded".

 ObjectPrefab = Resources.Load("PrefabStringName", typeof(GameObject)) as GameObject;
 ObjectCreated = (GameObject) Instantiate (ObjectPrefab, Vector3Position, QuaternionRotation);


As loaded as string name, you can use other string variables to create the string prefab name, like this to Instantiate a prefab called "VehicleMasterFire":

 string level = "Master"
 string type = "Fire"
 ObjectPrefab = Resources.Load(("Vehicle"+level+type), typeof(GameObject)) as GameObject;

And for the "(Clone)" in the name, you can use the Substring function to change it name when is created

Comment
Add comment · Show 2 · 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 tutiplain1 · Sep 10, 2017 at 09:14 PM 0
Share

Hi. After downgrading, the problem still ocurrs, so it's not a version problem. What else can I look for?

avatar image tormentoarmagedoom tutiplain1 · Sep 11, 2017 at 12:04 PM 0
Share

Answer Extended Upvote if helpful :D!

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

84 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 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 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 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

What can I do to make the objects I instantiated move with the background? 1 Answer

NullReferenceException: Object reference not set to an instance of an object spawn.Update () (at Assets/spawn.cs:24) 1 Answer

GUIText transition trouble 1 Answer

Instantiating Too Many Objects 1 Answer

Object reference not set to an instance of an object 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