• 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 KrisSchnee · Mar 14, 2014 at 04:27 AM · meshnewbiemeshfilterboo

Can't Make Mesh Display Using Quill18 Tilemap Tutorial (Boo conversion)

I'm working through the tilemap tutorials by Quill18, video 2, and since I'm coming mainly from a Python background I'd like to work in Boo. I think I've translated the code (and have tried just using his C# code), but I'm not seeing the rendered square that should be appearing. The code below is attached to a GameObject with a camera pointed at it. Judging from the tutorial video, it should be displaying a pink square (until a texture is added) but I see nothing at all.

Also, Unity is showing an error: "NullReferenceException: Object reference not set to an instance of an object. TileMap.BuildMesh() (at Assets/Tilemap.boo:21)". That line appears to be an assignment: "vertices[0] = Vector3(0,0,0)".

Does anyone know what's gone wrong, here?

 import UnityEngine
 
 ## Force these components to be created on the target object.
 [RequireComponent(MeshFilter)]
 [RequireComponent(MeshCollider)]
 [RequireComponent(MeshRenderer)]
 
 class TileMap (MonoBehaviour): 
 
     def Start():
         BuildMesh()
 
     def BuildMesh():
         vertices as (Vector3)
         triangles as (int)
         normals as (Vector3)
         uv as (Vector2)
         
         ## Generate mesh.
         
         vertices[0] = Vector3(0,0,0)
         vertices[1] = Vector3(1,0,0)
         vertices[2] = Vector3(0,0,-1)
         vertices[3] = Vector3(1,0,-1)
         
         triangles = (0,3,2,0,1,3)
 
         for n in range(4):
             normals[n] = Vector3.up
 
         uv[0] = Vector2(0,0)
         uv[1] = Vector2(1,0)
         uv[2] = Vector2(0,1)
         uv[3] = Vector2(1,1)        
 
         ## Original code was just the next line, but
         ## the following two are suggested by the official reference.        
         mesh = Mesh()
 #        mesh as Mesh = Mesh()
 #        GetComponent[of MeshFilter]().mesh = mesh
 
         ## Assign mesh data to mesh.                        
         mesh.vertices = vertices
         mesh.triangles = triangles
         mesh.normals = normals
         mesh.uv = uv
 
         mesh_filter = GetComponent(MeshFilter)
 
         mesh_filter.mesh = mesh
 
     def Update ():
         pass
 
Comment
Add comment · Show 2
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 AlucardJay · Mar 14, 2014 at 05:10 AM 0
Share

I added Boo to the title and tags so hopefully someone who knows it will help. Good Luck =]

avatar image getyour411 · Mar 14, 2014 at 05:15 AM 0
Share

don't know Boo but the def for vertices looks like a Vector3, not an array of - does it do that implicitly?

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

21 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

Related Questions

Mesh filters missing their meshes when project cloned from bitbucket 2 Answers

Array index is out of range in MeshMorpher 2 Answers

Can't change verts on mesh after assigning to meshfilter. 1 Answer

Cannot using two script to modify the same mesh at the same time 1 Answer

Query if MeshFilter is instantiated or shared? 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