hello,
im trying to make a 3d2d vgui which is attached to a prop, all is fine when i spawn the entity with the said 3d2dvgui code in it, but when i remove the entity it gives a null entity error.
I assume it is because the prop is gone so the pos is nil and it freaks out, but i have no idea how to make it stop rendering or whatever i need to do
heres my code
local sampleFrame = vgui.Create( "DFrame" )
sampleFrame:SetPos( 0, 0 )
sampleFrame:SetSize( 250, 250 )
sampleFrame:ParentToHUD()
hook.Add( "PostDrawOpaqueRenderables", "DrawDemoFrame", function()
vgui.Start3D2D( self:GetPos(), Angle(self:GetAngles()), 0.2 ) -- this line errors
sampleFrame:Paint3D2D()
vgui.End3D2D()
end )
end
function ENT:OnRemove()
sampleFrame:Close()
end
if not self:IsValid() then return end
vgui.Start3D2D( self:GetPos(), Angle(self:GetAngles()), 0.2 ) -- this line errors
self:Paint3D2D()
vgui.End3D2D()
Untested but it should works.
Good luck
worked fine but self:Paint3D2D() had to be SampleFrame:Paint3D2D()
thanks!
Oh yeah forgot in that context self would be the object 'vgui', ^^'
Sorry, you need to Log In to post a reply to this thread.