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 ChaoticDeath · Apr 10, 2012 at 01:00 PM · guiguitextureloopinggui texture

Change Gui Textre to another overtime? and reset script when player passes through trigger

Well Basically i want a Gui Texture to change to another gui texture 1 min later, and then to another Gui Texture another 1 min later, (max 2 times) and when u walk through a trigger the script resets happening all over again.

SO e.g. green icon goes to yellow, yellow icon goes to red (1 min intervals) player walks through a Trigger, it all resets going back to the first Gui texture happening all over again.

hope i worded this correctly. any ideas? i wouldnt know how to start a script like this.

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
1
Best Answer

Answer by aldonaletto · Apr 10, 2012 at 01:27 PM

You can set a timer to loop through the textures in Update, and reset this loop in OnTriggerEnter - like this (trigger script):

var gTexture: GUITexture; // drag the GUITexture here var textures: Texture2D[]; // define the textures here var interval: float = 60.0; // interval in seconds

private var timer: float = 0.0; private var curTex: int = 0;

function Update(){ timer -= Time.deltaTime; // decrement timer if (timer < 0.0) SetTexture(); // set the texture }

function SetTexture(){ gTexture.texture = textures[curTex++]; // assign current texture and advance pointer curTex = curTex % textures.length; // return to first one if passed the last timer = interval; // reset timer }

function OnTriggerEnter(){ curTex = 0; // reset texture pointer... SetTexture(); // assign current texture and reset timer }

Comment
Add comment · Show 1 · 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 ChaoticDeath · Apr 11, 2012 at 08:26 AM 0
Share

Wow,exactly what i was looking for, thank you.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Best way to handle clicking on a GUI.DrawTexture? 1 Answer

Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer

Write a Shader for GUI (GUITexture or scripted GUI) 0 Answers

Help! Hiding/showing GUITextures! 1 Answer

I am trying to send a 2D texture to my first person controller to display on the GUI 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