Jump to content

Spritesheets and prefabs


Rick
 Share

Recommended Posts

We had this issue when we made the Cobra demo. When we have an emitter that uses a spritesheet (making an explosion) and make that a prefab that emitter won't cycle through the spritesheet. It just shows the entire spritesheet.

 

As a workaround is there a way to unlink a prefab? It works if the prefab is no longer an instanced prefab (when I do this via the editor it makes the spritesheet play. Can I do this via code?).

 

Trying to work around this. My explosion is a parent pivot and 4 emitter children (one being the spritesheet of fireball explosion, others being smoke and dust kicking up). I pass this as a script parameter to the thing I want to blow up. That works but clearly if I want 5 things to blow up the can't all share the same explosion. So I figured I'll use :Instance() on the passed in explosion entity. That gives the same results as the prefab where the entire spritesheet is displayed vs cycling through the sub images so that doesn't work.

 

Any other ideas?

Link to comment
Share on other sites

As a workaround is there a way to unlink a prefab? It works if the prefab is no longer an instanced prefab (when I do this via the editor it makes the spritesheet play. Can I do this via code?).

If you change any of the properties, the editor will ask you if you want to unlink the prefab.

 

--EDIT I ran into this before and it looks like the issue is the emitter's animation columns and rows are being set to 1 no matter what is set in the prefab. The way I have been able to get around this bug is by attaching a small script to the emitter that sets the columns and rows.

function Script:Start()

self.entity:SetAnimationColumns(6)

self.entity:SetAnimationRows(6)

end

The below picture shows a emitter with the above script saved as a prefab and a emitter without the script saved as a prefab loaded into the scene.

post-14-0-89607500-1481681450_thumb.jpg

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...