• 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 Darkgecko777 · Jan 03, 2016 at 09:12 AM · instantiate prefabmeshfilter

Meshfilter missing on Instantiation of prefab for Hex creation

I am attempting to create hex tiles, each as their own gameobject (eventually to fill an array). If I take a gameobject with the appropriate mesh properties and make an instance of it in the editor with an appropriate script to calculate and draw the hex at start, I get a rendered hex. My meshfilter in the gameobject is empty initially but on program start it creates a mesh and assigns it correctly so that I have the meshfilter attribute occupied. However, when I take a prefab of my hex gameobject I get some very odd results trying to instantiate it. I have a main gameobject which has a script with a public var to which I link my prefab. I can successfully instantiate the prefab but when I call the function to render the hex it does not occupy the meshfilter. To add to the confusion, if I instantiate and call the function in update it repeatedly spawns gameobjects (as I would expect) but each of them aside from the first has the meshfilter occupied and renders appropriately. I tried instantiating in awake and calling the function to render in start but no good. If I just repeat the instantiation and call twice in start I get two gameobjects, one with an empty meshfilter and one correctly filled. Thoughts on how I can instantiate just a single gameobject with a correctly filled meshfilter?

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 Darkgecko777 · Jan 02, 2016 at 01:32 AM 0
Share

Turns out that the resolution is somewhat counter-intuitive. I was instantiatiing then calling the function but when I swapped it and called the function before instantiating...voila. Still sort of puzzled since I would assume a gameobject could change the filter once it was instantiated but perhaps the answer to that is found elsewhere.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to shoot Top Down Plane 2D? 1 Answer

[Solved] Change a bool of one of many instantiated clones 1 Answer

Creating a List of render textures for instantiated GameObjects with cameras 0 Answers

Countdown not working (instantiating on count<=0) 2 Answers

AAPT Failed! 0 custom asset files in raw for Procedural Examples Paint Vertices to Android 2 Answers


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