Jump to content

How to have prefabs be unique and load scripts


Rick
 Share

Recommended Posts

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/asset/

 

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/prefab/prefabload-r622

 

 

I want each prefab to have their own materials AND to load scripts. I switch materials on prefabs that I shoot and I don't want all the others to have their materials switched.

 

 

local bomb = Prefab:Load(self.BombPrefab, Asset.Unmanaged or Asset.LoadScripts)

 

 

1) How do we do bitwise operations in Lua to get this?

 

2) What is the constant variable names for both of these? Asset.LoadScripts doesn't seem to work

Link to comment
Share on other sites

In real time , i use SetColor() to change the color diffuse of any instanced entity.

Should be possible with some sort of SetDiffTexture ?

or SetMaterial() ?

Didn't dig the docs.

 

Can we change material or shader at run time , in game ? in LE3 ?

Stop toying and make games

Link to comment
Share on other sites

I do change the material at run-time to get this effect, but since the models are instances of each other they share a material which means when 1 changes they all change. There is a way when loading models (not prefabs) to make model instances that use their own material, and I need to do this with prefabs.

 

For now I guess I could use SetColor() to shade everything red though, but this would still be nice.

 

 

[edit]

The red shading doesn't look at good because the body is black and you can't see the change. In what I was doing I made another texture that painted the black body red, which is a much better effect. The original question stands.

Link to comment
Share on other sites

It's Prefab system i think.

A prefab is for instancing, so one modification, modifies all instances.

 

Solution :

Don't use prefabs , create your own loader with some parameters as shader;color or whatever.

I have entities not prefab so change color on one only don't change others.

Stop toying and make games

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...