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 unity_2aPkpqA298SxQw · Apr 26, 2019 at 08:33 AM · 2dprefabspriterenderer

Prefab of SpriteShapeRenderer not rendered if first point not visible ?

Hello,

So my problem is that I have a prefab of a SpriteShapeController that I instantiate and generate points out of the field of view of the camera, and then it's supposed to appear in the field of view of the camera but the spriteShape is not rendered until the first point of the SpriteShape is in the field of view. After a long time of struggling and not understanding why the spriteShape were not visible (even in the scene view if the camera don't have in the field of view the first point the prefab is not visible in scene view) I came to this conclusion.

I don't really know what to do, maybe I'm not using well the SpriteShapeRenderer ? Does somebody already had this problem ?

Prefab : alt text

The spriteShape only have 2 points in the prefab then at the Instantiation of the prefab i create more points in the script SpriteShapeManagerBrackground :

     public void Start()
     {
 
         spriteShapeController = GetComponent<SpriteShapeController>();
         previousPoint = spriteShapeController.spline.GetPosition(0);
         newPoint = spriteShapeController.spline.GetPosition(1);
         firstPoint = previousPoint;
         for (int i = 0; i < 100; i++)
         {
             this.AddPoint();
         }
 
     }

And where I instantiate the prefab :

     public void AddBackgroundPath(float y, float z)
     {
         GameObject go = Instantiate(toClone, new Vector3(this.cameraScript.camera.transform.position.x+ 250, y + UnityEngine.Random.Range(-200, 200), z), Quaternion.identity);
         go.GetComponent<SpriteShapeManagerBackground>().camera = this.cameraScript;
 
     }
prefabunityforum.png (77.9 kB)
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 RedHillbilly · Oct 29, 2020 at 06:08 PM 0
Share

I have the same issue, did you find a solution?

side note: I don't think you need the sprite renderer as the shape is rendered with the sprite shape renderer

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by RedHillbilly · Oct 29, 2020 at 08:50 PM

Found a possible solution by scrolling this thread: https://forum.unity.com/threads/tel...-with-sprite-shape.686305/page-3#post-6083610

But it only works if the shape doesn't change in time, otherwise you need to uncheck DestroyOnCompletion which might be heavy on computation.

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

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

Changing SpriteRenderer order in script 1 Answer

Sprite is missing in SpriteRenderer in some prefabs 0 Answers

Prefab to a tile script 0 Answers

prefab instantiated by script containing ShadowCaster2D bugs out 0 Answers

How to nine slice a 2D SpriteRenderer? 0 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