Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9132531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:19:36+00:00 2026-06-17T08:19:36+00:00

How can I add a shader to a game object? a have a shader

  • 0

How can I add a shader to a game object? a have a shader defined here:

(i am trying to do the same thing and am having some problems): http://answers.unity3d.com/questions/175692/getpixelsetpixels-or-stencil-eraser-brush.html

and 2 texture2D defined in code and loaded through Resource.Load, assigned to a game object. How can I apply the shader to my game object and communicate with the two textures?

As you can see, I have this code in my Shader

_MainTex("Main Texture (rgb)", 2D) = "white" {}
_Color ("Main Color", Color) = (1,1,1,1)
_Stencil("Stencil Texture (a)", 2D) = "white" {}

how can I tell the shader who is Main Texture and Stencil Texture?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:19:37+00:00Added an answer on June 17, 2026 at 8:19 am

    To apply a shader, you need a material.

    You can create a material by clicking ‘create’ in the project view.

    If you use the shader code from the given link, the shader should be in the shader dropdown list in the inspector when selecting a material, under Custom.

    You can change the main texture or the other properties through code or in the inspector.

    See here:
    http://docs.unity3d.com/Documentation/ScriptReference/Material.SetTexture.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You can add product to compare. I have to show the link Add to
I am completely stumped here. I have the following fragment shader working: varying lowp
Tell me, please, how I can add new vertex in vertex shader?
Since GLSL doesn't have an include-file option I'm trying to add this by using
Magento can add a suffix that is defined by the user to append onto
I can add a player object to my UI layout in the MainWindow constructor,
I can add and remove the last line in my dynamic form and calculate
I can add a normal rightBarButton to my navigation without a problem but now
I can add a Conditional statement to a breakpoint, for instance arg0.startsWith(something) but i'd
We can add an image to an photo album using UIImage *img = [UIImage

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.