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
1
Question by KnightRiderGuy · Feb 09, 2015 at 05:40 PM · uiaudiorendertextureui image

Is it possible to Render Spectrum Data onto a UI Image?

Is it possible to render spectrum data onto a UI image in the same way that this screen capture of GUI windows is done? And if so how would this be done? I know I can do it with a GUI image. But UI is better for layout management. This you would THINK would have an answer by now? alt text

screen-shot-2015-02-09-at-113643-am.png (71.4 kB)
Comment
Add comment · Show 5
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 smoggach · Feb 09, 2015 at 06:39 PM 0
Share

Possible? Yes. It's even easier if you understand the data. I'd search for a good graphing plugin.

avatar image KnightRiderGuy · Feb 09, 2015 at 07:01 PM 0
Share

Thanks Smoggach, Well I have Visualizer Studio, it's where the screen cap comes from, but having trouble translating the old GUI window stuff to the new UI way of doing things.

avatar image KnightRiderGuy · Mar 08, 2015 at 11:58 PM 0
Share

I can get it to work with this only I need it to work on a UI image or UI Raw image, whichever is best suitable for this type of thing.

 using UnityEngine;
 using UnityEngine.UI;
 using System.Collections;
 
 //[RequireComponent(typeof(AudioSource))]
 [RequireComponent(typeof(GUITexture))]
 public class AudioWaveFormVisualizer : $$anonymous$$onoBehaviour
 {
     
     public AudioSource $$anonymous$$usicPlayer;
     public int width = 500; // texture width 
     public int height = 100; // texture height 
     public Color backgroundColor = Color.black; 
     public Color waveformColor = Color.green; 
     public int size = 2048; // size of sound segment displayed in texture
     
     private Color[] blank; // blank image array 
     private Texture2D texture;
     private float[] samples; // audio samples array
     
     IEnumerator Start ()
     { 
         
         // create the samples array 
         samples = new float[size]; 
         
         // create the texture and assign to the guiTexture: 
         texture = new Texture2D (width, height);
         
         guiTexture.texture = texture; 
         
         // create a 'blank screen' image 
         blank = new Color[width * height]; 
         
         for (int i = 0; i < blank.Length; i++) { 
             blank [i] = backgroundColor; 
         } 
         
         // refresh the display each 100mS 
         while (true) {
             GetCurWave (); 
             yield return new WaitForSeconds (0.1f); 
         } 
     }
     
     void GetCurWave ()
     { 
         // clear the texture 
         texture.SetPixels (blank, 0);
 
         
         // get samples from channel 0 (left) 
         $$anonymous$$usicPlayer.GetOutputData (samples, 0); 
         
         // draw the waveform 
         for (int i = 0; i < size; i++) { 
             texture.SetPixel ((int)(width * i / size), (int)(height * (samples [i] + 1f) / 2f), waveformColor);
 
         } // upload to the graphics card 
         
         texture.Apply ();
     } 
 }
avatar image KnightRiderGuy · Mar 16, 2015 at 07:13 PM 0
Share

I can render the waveform spectrum data to a GUI image and then parent the game object it's on to a canvas or panel but results would be better if the same method could be used on either a UI image or UI raw image??? $$anonymous$$ust be a way to do this???

avatar image Nerevar · Mar 31, 2015 at 12:38 PM 0
Share

well you have to work with a texture at first, then you apply the texture to your UI image

RawImage can take a "raw" texture (RawImage.texture) or you have to create a sprite from your texture with Sprite.Create() then set this sprite on your image.

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.

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

Canvas doesn't display on VR andriod 0 Answers

Getting 3D Meshes to render with UI according to heirarchy 0 Answers

Scrolling one UI image causes every other UI image to start scrolling 1 Answer

how Can I make a UI Image Blink On And Off 5 Answers

Clamp UI Image to Canvas 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