Git Product home page Git Product logo

Comments (10)

popcron avatar popcron commented on August 23, 2024 1

Are you using SRP? This package works in all versions that aren't using SRP, and if you are then only in 2019.3.

from gizmos.

Hykrow avatar Hykrow commented on August 23, 2024 1

Oh ok i now changed the OnDrawGizmos function ( i forget that it was obviously not being called if it is run in the built version haha) to just Draw then calling it from the update method, it now works perfectly ! Thanks a lot from your work and your help :)

from gizmos.

RunninglVlan avatar RunninglVlan commented on August 23, 2024

Showing the script you're using could help

from gizmos.

Kabum80 avatar Kabum80 commented on August 23, 2024

Oh, my bad.

I just test it with example code from the readme file.
Doesn't work.*

using UnityEngine;
using Gizmos = Popcron.Gizmos;
public class GizmoDrawer : MonoBehaviour
{
public Material material = null;

private void Update()
{
    //use custom material, if null it uses a default line material
    Gizmos.Material = material;
    
    //toggle gizmo drawing using the same key as in minecraft
    if (Input.GetKeyDown(KeyCode.F3))
    {
        Gizmos.Enabled = !Gizmos.Enabled;
    }
    
    //draw a line from the position of the object, to world center
    //with the color green, and dashed as well
    Gizmos.Line(transform.position, Vector3.one, Color.green, true);
    
    //draw a cube at the position of the object, with the correct rotation and scale
    Gizmos.Cube(transform.position, transform.rotation, transform.lossyScale);
}

}`

from gizmos.

popcron avatar popcron commented on August 23, 2024

To be clear, does it show only in play mode, only in edit mode, or neither? @Kabum80

I just tested the example readme script and it worked.

from gizmos.

RunninglVlan avatar RunninglVlan commented on August 23, 2024

@Kabum80, if you resolved your issue, you could write about it here (what was the problem, how you solved it). It might help others with similar problems. ;)

from gizmos.

RunninglVlan avatar RunninglVlan commented on August 23, 2024

I might know what it was.
With current example it is impossible to render on both Scene and Game views at the same time. If your layout shows both Scene and Game views at the same time, example code will render only on one view - for me it is Scene view, but it can be changed if you will play with windows.
But if Game view is active only on Play (which means Scene view is inactive on Play), then everything works alright - example is rendered on both views when they're switched.

BTW, example code is now rendered only in Play mode. If you want to see Gizmos in Edit mode too, following code can be used (this will also render on both Scene and Game views at the same time:

[ExecuteInEditMode] // add this Attribute
public class GizmoDrawer : MonoBehaviour
...
    void OnRenderObject() // use this instead of Update
...

ExecuteInEditMode
MonoBehaviour.OnRenderObject

from gizmos.

Hykrow avatar Hykrow commented on August 23, 2024

Hello, i have the same issue as @Kabum80 (but mine dont show at any moments) , so i tried to follow @RunninglVlan 's solution. But it does not works for me or i followed your idea wrong, but idk why since i tried to add ExecuteInEditMode and i dont think i have multiple game views at the same time. My code is:
using Gizmos = Popcron.Gizmos; . . . Gizmos.Line(Vector3.one, n.worldPosition);
I also use unity 2019.2.3f1.
TIA

from gizmos.

Hykrow avatar Hykrow commented on August 23, 2024

No, i do not think I use SRP.At least i do not remember using it or ever heard of it. Looks weird.
As you can see here :https://imgur.com/a/bXMhF3l the white thing is drawn by lines (it does a weird effect bc i changes the z pos trough the line so i am sure at least a part is displayed,
But on the built version, it doesnt : https://imgur.com/a/yJpgfxQ

from gizmos.

popcron avatar popcron commented on August 23, 2024

The weird effect in game view is because your view is scaled down to below 1x, causing some pixels to not render because there's the resolution was reduced. As for the build, do you know if Gizmos.Enabled is set to true, and that the code for rendering is running?

from gizmos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.